From 3f85f792c2096e100817b7be739dffa8d1f3a50e Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Thu, 24 Oct 2024 20:31:19 -0400 Subject: [PATCH] fix cassandra tests --- pom.xml | 9 +++ run-integration-tests.sh | 59 +++++++++++++++++++ run-integration-tests.sh~ | 59 +++++++++++++++++++ .../test/resources/test_wiki_full_schema.cql | 16 ----- .../resources/test_wiki_partial_0_schema.cql | 16 ----- .../resources/test_wiki_partial_1_schema.cql | 16 ----- .../resources/test_wiki_partial_2_schema.cql | 16 ----- .../resources/test_wiki_partial_3_schema.cql | 16 ----- .../resources/test_wiki_partial_4_schema.cql | 16 ----- 9 files changed, 127 insertions(+), 96 deletions(-) create mode 100755 run-integration-tests.sh create mode 100755 run-integration-tests.sh~ diff --git a/pom.xml b/pom.xml index 872ad4ed7f..941d24ebde 100644 --- a/pom.xml +++ b/pom.xml @@ -330,6 +330,15 @@ ${maven-surefire-plugin.version} ${surefireArgLine} + + false + false + + + plain + + + false diff --git a/run-integration-tests.sh b/run-integration-tests.sh new file mode 100755 index 0000000000..5fdc16847b --- /dev/null +++ b/run-integration-tests.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Store the root directory (where mvnw is located) +ROOT_DIR="$(pwd)" + +# Check if we're in the correct directory +if [ ! -f "./mvnw" ]; then + echo "Error: Must be run from directory containing mvnw" + exit 1 +fi + +# Check if vector-store directory exists +if [ ! -d "./vector-stores" ]; then + echo "Error: vector-stores directory not found" + exit 1 +fi + +# Function to log with timestamp +log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" +} + +# Get list of directories +log "Finding directories under ./vector-store" +directories=$(find ./vector-stores -type d -mindepth 1) + +if [ -z "$directories" ]; then + log "No directories found under ./vector-stores" + exit 1 +fi + +# Print found directories +log "Found directories:" +echo "$directories" | sed 's/^/ /' + +# Process each directory +while IFS= read -r dir; do + log "Processing directory: $dir" + cd "$dir" || continue + + log "Running Maven integration tests for $dir" + # Use the mvnw from the root directory + "$ROOT_DIR/mvnw" package -Pintegration-tests + + build_status=$? + if [ $build_status -eq 0 ]; then + log "Maven build completed successfully for $dir" + else + log "Maven build failed for $dir" + # Return to root directory before exiting + cd "$ROOT_DIR" + exit 1 + fi + + # Return to root directory for next iteration + cd "$ROOT_DIR" +done <<< "$directories" + +log "All directories processed successfully" diff --git a/run-integration-tests.sh~ b/run-integration-tests.sh~ new file mode 100755 index 0000000000..5bf152231a --- /dev/null +++ b/run-integration-tests.sh~ @@ -0,0 +1,59 @@ +#!/bin/bash + +# Store the root directory (where mvnw is located) +ROOT_DIR="$(pwd)" + +# Check if we're in the correct directory +if [ ! -f "./mvnw" ]; then + echo "Error: Must be run from directory containing mvnw" + exit 1 +fi + +# Check if vector-store directory exists +if [ ! -d "./vector-store" ]; then + echo "Error: vector-store directory not found" + exit 1 +fi + +# Function to log with timestamp +log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" +} + +# Get list of directories +log "Finding directories under ./vector-store" +directories=$(find ./vector-store -type d -mindepth 1) + +if [ -z "$directories" ]; then + log "No directories found under ./vector-store" + exit 1 +fi + +# Print found directories +log "Found directories:" +echo "$directories" | sed 's/^/ /' + +# Process each directory +while IFS= read -r dir; do + log "Processing directory: $dir" + cd "$dir" || continue + + log "Running Maven integration tests for $dir" + # Use the mvnw from the root directory + "$ROOT_DIR/mvnw" package -Pintegration-tests + + build_status=$? + if [ $build_status -eq 0 ]; then + log "Maven build completed successfully for $dir" + else + log "Maven build failed for $dir" + # Return to root directory before exiting + cd "$ROOT_DIR" + exit 1 + fi + + # Return to root directory for next iteration + cd "$ROOT_DIR" +done <<< "$directories" + +log "All directories processed successfully" diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_full_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_full_schema.cql index 86a8d93fbd..c6f6cf17a5 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_full_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_full_schema.cql @@ -1,19 +1,3 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS test_wikidata.articles ( diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_0_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_0_schema.cql index 42724e314e..d2f3fcd622 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_0_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_0_schema.cql @@ -1,17 +1 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_1_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_1_schema.cql index 5b0064c301..cb1a535824 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_1_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_1_schema.cql @@ -1,19 +1,3 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS test_wikidata.articles ( diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_2_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_2_schema.cql index 759374499a..5853b2274f 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_2_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_2_schema.cql @@ -1,19 +1,3 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS test_wikidata.articles ( diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_3_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_3_schema.cql index 673a77e68a..a605116ca3 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_3_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_3_schema.cql @@ -1,19 +1,3 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS test_wikidata.articles ( diff --git a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_4_schema.cql b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_4_schema.cql index 564eb23330..68b4583c49 100644 --- a/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_4_schema.cql +++ b/vector-stores/spring-ai-cassandra-store/src/test/resources/test_wiki_partial_4_schema.cql @@ -1,19 +1,3 @@ -/* - * Copyright 2023-2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - CREATE KEYSPACE IF NOT EXISTS test_wikidata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE IF NOT EXISTS test_wikidata.articles (