-
Notifications
You must be signed in to change notification settings - Fork 66
control-service: secrets service integration test #2289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dakodakov
merged 36 commits into
main
from
person/ddakov/vault-secrets-service-integration-test
Jun 22, 2023
Merged
Changes from 13 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
aa20f0b
control-service: secrets service integration test
74e375d
Google Java Format
25421c0
versatile-data-kit: update config.yaml template
antoniivanov 1ccd44e
control-service: secrets service integration test
ff99357
Google Java Format
1e8ae70
Merge branch 'person/ddakov/vault-secrets-service-integration-test' o…
e3bae38
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d694935
control-service: secrets service integration test
dccd5a3
control-service: secrets service integration test
fbae133
control-service: secrets service integration test
d572071
Google Java Format
9a95e14
control-service: multiple namespaces in testing (#2269)
murphp15 48ae6b8
vdk-notebook: handle job with mixed .ipynb, .py, .sql files use-cas…
duyguHsnHsn 65c1acb
control-service: secrets service integration test
c18dcc2
Google Java Format
f2a4b60
control-service: install kubectl (#2290)
murphp15 47d35dd
control-service: move cron jobs methods to the data jobs class (#2291)
murphp15 75e736c
specs: VEP-2272 Complete Data Job Configuration Persistence (#2287)
mivanov1988 aef4836
control-service: fix failing pipelines (#2296)
murphp15 0954c5b
build(deps): Bump org.json:json from 20230227 to 20230618 in /project…
dependabot[bot] 1c985b8
build(deps): Bump com.amazonaws:aws-java-sdk-core from 1.12.490 to 1.…
dependabot[bot] 725d1bf
build(deps): Bump net.javacrumbs.shedlock:shedlock-spring from 5.4.0 …
dependabot[bot] 44667b1
control-service: secrets service integration test
14b2274
Google Java Format
7c0337d
control-service: secrets service integration test
31b81f0
Google Java Format
37de719
control-service: secrets service integration test
e8f593c
control-service: secrets service integration test
c66ebf1
control-service: secrets service integration test
d3e3267
Google Java Format
7e248da
control-service: secrets service integration test
0aa98d2
Google Java Format
b9cb1e8
Merge branch 'person/ddakov/vault-secrets-service-integration-test' o…
59ae7d7
Google Java Format
2dc2dbc
control-service: secrets service integration test
cbd206e
control-service: secrets service integration test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
.github/ISSUE_TEMPLATE/config.yaml → .github/ISSUE_TEMPLATE/config.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| # Copyright 2021-2023 VMware, Inc. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| blank_issues_enabled: false | ||
| contact_links: | ||
| - name: "\U0001F914 All other questions, including if you're not sure what to do." | ||
| url: https://github.com/jupyterlab/jupyterlab/discussions/new?category=q-a | ||
| about: Search Github Discussions for similar questions or ask for help there. | ||
| - name: "\U0001F4AC Chat with the devs on Versatile Data Kit slack channel in CNCF slack " | ||
| url: https://communityinviter.com/apps/cloud-native/cncf | ||
| about: Ask short questions about using Versatile Data Kit | ||
| url: https://communityinviter.com/apps/cloud-native/cncf | ||
| about: Ask short questions about using Versatile Data Kit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...ation-test/java/com/vmware/taurus/secrets/service/vault/TestVaultJobSecretsServiceIT.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* | ||
| * Copyright 2021-2023 VMware, Inc. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package com.vmware.taurus.secrets.service.vault; | ||
|
|
||
| import com.fasterxml.jackson.core.JsonProcessingException; | ||
| import com.vmware.taurus.ControlplaneApplication; | ||
| import com.vmware.taurus.datajobs.it.common.BaseIT; | ||
| import com.vmware.taurus.exception.DataJobSecretsSizeLimitException; | ||
| import org.apache.commons.lang3.RandomStringUtils; | ||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.springframework.boot.test.context.SpringBootTest; | ||
| import org.springframework.vault.authentication.TokenAuthentication; | ||
| import org.springframework.vault.client.VaultEndpoint; | ||
| import org.springframework.vault.core.VaultTemplate; | ||
| import org.testcontainers.junit.jupiter.Container; | ||
| import org.testcontainers.junit.jupiter.Testcontainers; | ||
| import org.testcontainers.vault.VaultContainer; | ||
|
|
||
| import java.net.URI; | ||
| import java.net.URISyntaxException; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
|
||
| @SpringBootTest( | ||
| webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, | ||
| classes = ControlplaneApplication.class) | ||
| @Testcontainers | ||
| public class TestVaultJobSecretsServiceIT extends BaseIT { | ||
|
|
||
| @Container | ||
| private static final VaultContainer vaultContainer = | ||
| new VaultContainer<>("vault:1.0.2").withVaultToken("root"); | ||
|
|
||
| private static VaultJobSecretsService vaultJobSecretService; | ||
|
|
||
| @BeforeAll | ||
| public static void init() throws URISyntaxException { | ||
| String vaultUri = vaultContainer.getHttpHostAddress(); | ||
|
|
||
| VaultEndpoint vaultEndpoint = VaultEndpoint.from(new URI(vaultUri)); | ||
| TokenAuthentication clientAuthentication = new TokenAuthentication("root"); | ||
|
|
||
| VaultTemplate vaultTemplate = new VaultTemplate(vaultEndpoint, clientAuthentication); | ||
|
|
||
| vaultJobSecretService = new VaultJobSecretsService(vaultTemplate); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetEmptyDataJobSecrets() throws Exception { | ||
| Map<String, Object> result = vaultJobSecretService.readJobSecrets("testJob"); | ||
| Assertions.assertEquals(Collections.emptyMap(), result); | ||
| } | ||
|
|
||
| @Test | ||
| public void testSetDataJobSecrets() throws Exception { | ||
| Map<String, Object> temp = new HashMap<>(); | ||
| temp.put("key1", "value1"); | ||
|
|
||
| Map<String, Object> secrets = Collections.unmodifiableMap(temp); | ||
|
|
||
| vaultJobSecretService.updateJobSecrets("testJob2", secrets); | ||
|
|
||
| Map<String, Object> readResult = vaultJobSecretService.readJobSecrets("testJob2"); | ||
| Assertions.assertEquals(secrets, readResult); | ||
| } | ||
|
|
||
| @Test | ||
| void testUpdateJobSecretsLimit() throws JsonProcessingException { | ||
| Map<String, Object> temp = new HashMap<>(); | ||
| temp.put("key1", "value1"); | ||
|
|
||
| Map<String, Object> secrets = Collections.unmodifiableMap(temp); | ||
|
|
||
| vaultJobSecretService.updateJobSecrets("testJob2", secrets); | ||
|
|
||
| Map<String, Object> largeSecrets = new HashMap<>(); | ||
| largeSecrets.put("key1", null); | ||
| largeSecrets.put( | ||
| "key2", | ||
| RandomStringUtils.randomAlphabetic(VaultJobSecretsService.VAULT_SIZE_LIMIT_DEFAULT)); | ||
|
|
||
| assertThrows( | ||
| DataJobSecretsSizeLimitException.class, | ||
| () -> vaultJobSecretService.updateJobSecrets("testJob2", largeSecrets)); | ||
|
|
||
| // check secrets were not updated | ||
| Map<String, Object> readResult = vaultJobSecretService.readJobSecrets("testJob2"); | ||
| Assertions.assertEquals(secrets, readResult); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.