From 0ffc7fadd33ae9de1d572f569b31a5ab131d8991 Mon Sep 17 00:00:00 2001 From: Cedrick Lunven Date: Wed, 17 Jul 2024 13:05:57 +0200 Subject: [PATCH] new workflows --- .../ci-astra-dev-vectorize-hf-dedicated.yml | 2 +- .../integration/AbstractVectorizeITTest.java | 11 +-- .../prod/AstraProdDevopsITTest.java | 73 +------------------ 3 files changed, 7 insertions(+), 79 deletions(-) diff --git a/.github/workflows/ci-astra-dev-vectorize-hf-dedicated.yml b/.github/workflows/ci-astra-dev-vectorize-hf-dedicated.yml index 321774df..1c985770 100644 --- a/.github/workflows/ci-astra-dev-vectorize-hf-dedicated.yml +++ b/.github/workflows/ci-astra-dev-vectorize-hf-dedicated.yml @@ -1,4 +1,4 @@ -name: AstraDev | HF Dedicated +name: AstraDev | Vectorize HF Dedicated on: #push: diff --git a/astra-db-java/src/test/java/com/datastax/astra/test/integration/AbstractVectorizeITTest.java b/astra-db-java/src/test/java/com/datastax/astra/test/integration/AbstractVectorizeITTest.java index f8d5b3b2..55bf19a9 100644 --- a/astra-db-java/src/test/java/com/datastax/astra/test/integration/AbstractVectorizeITTest.java +++ b/astra-db-java/src/test/java/com/datastax/astra/test/integration/AbstractVectorizeITTest.java @@ -1,10 +1,8 @@ package com.datastax.astra.test.integration; import com.datastax.astra.client.Collection; -import com.datastax.astra.client.DataAPIClients; -import com.datastax.astra.client.Database; -import com.datastax.astra.client.admin.AstraDBAdmin; -import com.datastax.astra.client.admin.DatabaseAdmin; +import com.datastax.astra.client.auth.EmbeddingAPIKeyHeaderProvider; +import com.datastax.astra.client.auth.EmbeddingHeadersProvider; import com.datastax.astra.client.model.CollectionOptions; import com.datastax.astra.client.model.CommandOptions; import com.datastax.astra.client.model.DataAPIKeywords; @@ -17,11 +15,6 @@ import com.datastax.astra.client.model.InsertManyResult; import com.datastax.astra.client.model.Projections; import com.datastax.astra.client.model.SimilarityMetric; -import com.datastax.astra.client.auth.EmbeddingAPIKeyHeaderProvider; -import com.datastax.astra.client.auth.EmbeddingHeadersProvider; -import com.dtsx.astra.sdk.db.domain.CloudProviderType; -import com.dtsx.astra.sdk.utils.AstraEnvironment; -import com.dtsx.astra.sdk.utils.Utils; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestMethodOrder; diff --git a/astra-db-java/src/test/java/com/datastax/astra/test/integration/prod/AstraProdDevopsITTest.java b/astra-db-java/src/test/java/com/datastax/astra/test/integration/prod/AstraProdDevopsITTest.java index 76fa5b8b..0cb31b12 100644 --- a/astra-db-java/src/test/java/com/datastax/astra/test/integration/prod/AstraProdDevopsITTest.java +++ b/astra-db-java/src/test/java/com/datastax/astra/test/integration/prod/AstraProdDevopsITTest.java @@ -1,33 +1,18 @@ package com.datastax.astra.test.integration.prod; -import com.datastax.astra.client.DataAPIClient; -import com.datastax.astra.client.Database; -import com.datastax.astra.client.admin.AstraDBDatabaseAdmin; -import com.datastax.astra.client.admin.DatabaseAdmin; -import com.datastax.astra.client.model.DatabaseInfo; import com.datastax.astra.test.integration.AbstractAstraDBAdminTest; import com.dtsx.astra.sdk.db.domain.CloudProviderType; import com.dtsx.astra.sdk.utils.AstraEnvironment; -import com.dtsx.astra.sdk.utils.Utils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.MethodOrderer; -import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import java.util.Optional; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - @EnabledIfEnvironmentVariable(named = "ASTRA_DB_APPLICATION_TOKEN", matches = "Astra.*") +@EnabledIfEnvironmentVariable(named = "ASTRA_CLOUD_PROVIDER", matches = ".*") +@EnabledIfEnvironmentVariable(named = "ASTRA_CLOUD_REGION", matches = ".*") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) class AstraProdDevopsITTest extends AbstractAstraDBAdminTest { - private static final String TMP_VECTOR_DB = "astra_db_admin_test"; - private static final String TMP_VECTOR_DB2 = "astra_db_admin_test2"; - @Override protected AstraEnvironment getAstraEnvironment() { return AstraEnvironment.PROD; @@ -35,62 +20,12 @@ protected AstraEnvironment getAstraEnvironment() { @Override protected CloudProviderType getCloudProvider() { - return null; + return CloudProviderType.valueOf(System.getenv("ASTRA_CLOUD_PROVIDER")); } @Override protected String getRegion() { - return ""; - } - - @Test - @Order(1) - void shouldConnectToDatabase() { - // Given - Assertions.assertNotNull(getAstraDbAdmin()); - - // Create a DB - Assertions.assertFalse(getAstraDbAdmin().databaseExists(TMP_VECTOR_DB)); - DatabaseAdmin dbAdmin = getAstraDbAdmin() - .createDatabase(TMP_VECTOR_DB, CloudProviderType.GCP, "us-east1"); - - // List DBs - assertThat(getAstraDbAdmin().listDatabaseNames()).contains(TMP_VECTOR_DB); - assertThat(getAstraDbAdmin().databaseExists(TMP_VECTOR_DB)).isTrue(); - - Optional info = getAstraDbAdmin().listDatabases() - .stream().filter(db -> db.getName().equals(TMP_VECTOR_DB)).findFirst(); - - // Access DB - assertThat(info).isPresent(); - assertThat(info.get().getName()).isEqualTo(TMP_VECTOR_DB); - UUID databaseId = info.get().getId(); - Database db = getAstraDbAdmin().getDatabase(databaseId); - Assertions.assertNotNull(db); - assertThat(getAstraDbAdmin().databaseExists(databaseId)).isTrue(); - - // Delete DB - getAstraDbAdmin().dropDatabase(databaseId); - } - - @Test - @Order(2) - void shouldCreateOtherDatabase() { - Assertions.assertFalse(getAstraDbAdmin().databaseExists(TMP_VECTOR_DB2)); - DatabaseAdmin dbAdmin = getAstraDbAdmin().createDatabase(TMP_VECTOR_DB2); - AstraDBDatabaseAdmin dbAmin2 = (AstraDBDatabaseAdmin) dbAdmin; - UUID databaseId = UUID.fromString(dbAmin2.getDatabaseInformations().getId()); - - Optional oToken = Utils.readEnvVariable("ASTRA_DB_APPLICATION_TOKEN"); - assertThat(oToken).isPresent(); - DataAPIClient client = new DataAPIClient(oToken.get()); - assertThat(client.getDatabase(databaseId)).isNotNull(); - assertThat(client.getDatabase(databaseId, "default_keyspace")).isNotNull(); - - Assertions.assertTrue(getAstraDbAdmin().databaseExists(TMP_VECTOR_DB2)); - getAstraDbAdmin().dropDatabase(TMP_VECTOR_DB2); + return System.getenv("ASTRA_CLOUD_REGION"); } - - } \ No newline at end of file