Skip to content

Commit

Permalink
secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Sep 28, 2023
1 parent 4632ebb commit 890bfb2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public void testProcessor() throws Exception {
deleteAppAndAwaitCleanup(tenant, applicationId);

final List<String> topics = getAllTopics();
Assertions.assertEquals(List.of("ls-test-topic0"), topics);
log.info("all topics: {}", topics);
Assertions.assertTrue(topics.contains("ls-test-topic0"));
Assertions.assertFalse(topics.contains("ls-test-topic1"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public static void checkCredentials() {

@Test
public void test() throws Exception {
if (!codeStorageConfig.type().equals("s3")) {
throw new IllegalStateException(
"This test can only run with S3 code storage, but got: "
+ codeStorageConfig.type());
}

appEnv.put("S3_ENDPOINT", codeStorageConfig.configuration().get("endpoint"));
appEnv.put("S3_ACCESS_KEY", codeStorageConfig.configuration().get("access-key"));
appEnv.put("S3_SECRET_KEY", codeStorageConfig.configuration().get("secret-key"));
installLangStreamCluster(true);
final String tenant = "ten-" + System.currentTimeMillis();
setupTenant(tenant);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,7 @@ private static KubeCluster getKubeCluster() {
public void setupSingleTest() {
// cleanup previous runs
cleanupAllEndToEndTestsNamespaces();
codeStorageProvider.cleanup();
streamingClusterProvider.cleanup();
cleanupEnv();

namespace = "ls-test-" + UUID.randomUUID().toString().substring(0, 8);

Expand All @@ -541,18 +540,29 @@ public void setupSingleTest() {
.serverSideApply();
}

private void cleanupEnv() {
if (codeStorageProvider != null) {
codeStorageProvider.cleanup();
}
if (streamingClusterProvider != null) {
streamingClusterProvider.cleanup();
}
}

@AfterEach
public void cleanupAfterEach() {
cleanupAllEndToEndTestsNamespaces();
streamingClusterProvider.cleanup();
cleanupEnv();
}

private static void cleanupAllEndToEndTestsNamespaces() {
client.namespaces().withLabel("app", "ls-test").delete();
client.namespaces().list().getItems().stream()
.map(ns -> ns.getMetadata().getName())
.filter(ns -> ns.startsWith(TENANT_NAMESPACE_PREFIX))
.forEach(ns -> deleteTenantNamespace(ns));
if (client != null) {
client.namespaces().withLabel("app", "ls-test").delete();
client.namespaces().list().getItems().stream()
.map(ns -> ns.getMetadata().getName())
.filter(ns -> ns.startsWith(TENANT_NAMESPACE_PREFIX))
.forEach(ns -> deleteTenantNamespace(ns));
}
}

private static void deleteTenantNamespace(String ns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ pipeline:
handle-cookies: true
max-unflushed-pages: 100
bucketName: "langstream-test-crawler-to-vector"
<<<<<<< Updated upstream
endpoint: http://minio.ls-test-minio.svc.cluster.local:9000
access-key: minioadmin
secret-key: minioadmin
=======
endpoint: "{{{secrets.s3.endpoint}}}"
access-key: "{{{secrets.s3.access-key}}}"
secret-key: "{{{secrets.s3.secret-key}}}"
>>>>>>> Stashed changes
- name: "Extract text"
type: "text-extractor"
- name: "Normalise text"
Expand Down
8 changes: 7 additions & 1 deletion langstream-e2e-tests/src/test/resources/secrets/secret1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ secrets:
environment: "${ASTRA_ENVIRONMENT}"
- id: kafka
data:
bootstrap-servers: "${KAFKA_BOOTSTRAP_SERVERS}"
bootstrap-servers: "${KAFKA_BOOTSTRAP_SERVERS}"

- id: s3
data:
endpoint: "${S3_ENDPOINT}"
access-key: "${S3_ACCESS_KEY}"
secret-key: "${S3_SECRET_KEY}"

0 comments on commit 890bfb2

Please sign in to comment.