From 7d0863efb044c36b9fa99639a409a014105602d2 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Tue, 24 Sep 2024 16:08:32 +0530 Subject: [PATCH 01/13] improved e2e tests --- e2e_tests/setup.sh | 12 +++++++++--- lib/active_graph/migrations/runner.rb | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index f8b3ec97c..e5f623b65 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -1,5 +1,6 @@ #!/bin/sh +# Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true gem install rails -v $ACTIVE_MODEL_VERSION --no-document if [[ -n "$ACTIVEGRAPH_PATH" ]] @@ -28,18 +29,23 @@ then mv dev_env.tmp config/environments/development.rb fi +echo "Generating model" bundle exec rails generate model User name:string +echo "Generating migration" bundle exec rails generate migration BlahMigration +echo "Running migration" bundle exec rake neo4j:migrate -if echo 'puts "hi"' | bundle exec rails c +if echo 'puts "Starting rails console"' | bundle exec rails c then - echo "rails console works correctly" + echo "Rails console works correctly" else + echo "Rails console didn't start" exit 1 fi -bundle exec rails s -d +echo "Starting rails server" +bundle exec rails s & until $(curl --output /dev/null --silent --head --fail localhost:3000); do printf '.' sleep 1 diff --git a/lib/active_graph/migrations/runner.rb b/lib/active_graph/migrations/runner.rb index a7821db08..0a536f994 100644 --- a/lib/active_graph/migrations/runner.rb +++ b/lib/active_graph/migrations/runner.rb @@ -96,7 +96,7 @@ def handle_incomplete_states! return unless incomplete_states.any? incomplete_versions = incomplete_states.map(&:migration_id) fail MigrationError, <<-MSG -There are migrations struck in an incomplete states, that could not be fixed automatically: +There are migrations stuck in an incomplete states, that could not be fixed automatically: #{incomplete_versions.join('\n')} This can happen when there's a critical error inside a migration. From c752e401ac4aebf0ac8c9bdbda256fec39933ccb Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Tue, 24 Sep 2024 16:38:59 +0530 Subject: [PATCH 02/13] using github.sha --- .github/workflows/e2e_test.yml | 2 +- e2e_tests/setup.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index 434f7a213..058ee593f 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -48,7 +48,7 @@ jobs: run: while [ $((curl localhost:7474/ > /dev/null 2>&1); echo $?) -ne 0 ]; do sleep 1; done - name: Setup test rails app - run: ./e2e_tests/setup.sh + run: ./e2e_tests/setup.sh ${{ github.sha }} - name: Install dependencies run: bundle update diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index e5f623b65..b69279fcf 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -7,8 +7,8 @@ if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - echo "SHA=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_ENV - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$(git rev-parse "$GITHUB_SHA")"'"/' docs/activegraph.rb > template.tmp + # echo "SHA=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_OUTPUT + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp From 486e8047a777a94cf7ad4c5e654b1f3c2abbeb53 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Tue, 24 Sep 2024 16:48:25 +0530 Subject: [PATCH 03/13] Update e2e_test.yml --- .github/workflows/e2e_test.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index 058ee593f..ab0f370f8 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -48,7 +48,15 @@ jobs: run: while [ $((curl localhost:7474/ > /dev/null 2>&1); echo $?) -ne 0 ]; do sleep 1; done - name: Setup test rails app - run: ./e2e_tests/setup.sh ${{ github.sha }} + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + # For pull requests, get the SHA of the last commit in the PR + COMMIT_SHA=$(jq -r '.pull_request.head.sha' < "${{ github.event_path }}") + else + # For push events (like master branch), use the commit SHA + COMMIT_SHA="${{ github.sha }}" + fi + ./e2e_tests/setup.sh $COMMIT_SHA - name: Install dependencies run: bundle update From ed65c77a5402faba9ba1acc8edf69a8da8e3a149 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Tue, 24 Sep 2024 16:56:18 +0530 Subject: [PATCH 04/13] final cleanup --- .github/workflows/e2e_test.yml | 1 - e2e_tests/setup.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index ab0f370f8..ae22b76ff 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -19,7 +19,6 @@ jobs: ruby: [ jruby, ruby-3.2.5 ] neo4j: [ 5.22.0 ] active_model: [ 7.1.3 ] - # jruby will fail till bug https://github.com/jruby/jruby-openssl/issues/290 is fixed include: - ruby: jruby java-version: 17 diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index b69279fcf..7a7556801 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -7,7 +7,6 @@ if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - # echo "SHA=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_OUTPUT sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp fi From de93a0b50159b40f40959ce3c81cb4d080271ccd Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 11:41:47 +0530 Subject: [PATCH 05/13] Update setup.sh --- e2e_tests/setup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index 7a7556801..d7f80826f 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -1,13 +1,15 @@ #!/bin/sh # Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true + +rm -r myapp gem install rails -v $ACTIVE_MODEL_VERSION --no-document if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: "."/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp From 598b84b4dcad42a829fe143ab123d715080461e5 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 11:48:01 +0530 Subject: [PATCH 06/13] Update setup.sh --- e2e_tests/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index d7f80826f..3c78b7746 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -9,7 +9,7 @@ if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: "."/' docs/activegraph.rb > template.tmp + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: ".."/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp From ee1537b7c4b351b7cf7b97084960241102f637da Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 11:53:16 +0530 Subject: [PATCH 07/13] Update setup.sh --- e2e_tests/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index 3c78b7746..40e094e6b 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -9,7 +9,7 @@ if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: ".."/' docs/activegraph.rb > template.tmp + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: "../"/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp From 0ecc17387127ea2c6147e9e60c4c3615b9bab20a Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 11:59:11 +0530 Subject: [PATCH 08/13] Update setup.sh --- e2e_tests/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index 40e094e6b..a5130fe8f 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -9,7 +9,7 @@ if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', path: "../"/' docs/activegraph.rb > template.tmp + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp From 10c20b4db3e9da106a5ff024cb42f319e9508527 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 12:06:25 +0530 Subject: [PATCH 09/13] Update setup.sh --- e2e_tests/setup.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index a5130fe8f..3e0e99f5f 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -2,7 +2,6 @@ # Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true -rm -r myapp gem install rails -v $ACTIVE_MODEL_VERSION --no-document if [[ -n "$ACTIVEGRAPH_PATH" ]] From 8659d6580c1625a3e4d882fd1181d2c6a15f17ae Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 12:24:17 +0530 Subject: [PATCH 10/13] cleanup --- .github/workflows/e2e_test.yml | 1 + e2e_tests/setup.sh | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index fbae5c73f..ad01540c2 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -24,6 +24,7 @@ jobs: java-version: 17 env: ACTIVE_MODEL_VERSION: ${{ matrix.active_model }} + ACTIVEGRAPH_PATH: ../ JRUBY_OPTS: --debug -J-Xmx1280m -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF steps: - name: Start neo4j diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index 3e0e99f5f..0c58f0048 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -2,14 +2,10 @@ # Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true +# rm -r myapp gem install rails -v $ACTIVE_MODEL_VERSION --no-document -if [[ -n "$ACTIVEGRAPH_PATH" ]] -then - sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp -else - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp -fi +sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp rm -f ./template.tmp From 9c737178e059d5f8e83a9fd75a0b9f40a330d80c Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 12:28:55 +0530 Subject: [PATCH 11/13] Update setup.sh --- e2e_tests/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index 0c58f0048..b05992bcf 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -2,7 +2,7 @@ # Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true -# rm -r myapp +rm -r ./myapp gem install rails -v $ACTIVE_MODEL_VERSION --no-document sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp From 2e89221c76ba947da8dea2782580f76233bbab5f Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 12:34:01 +0530 Subject: [PATCH 12/13] Update e2e_test.yml --- .github/workflows/e2e_test.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index ad01540c2..d4fa0f064 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -48,15 +48,7 @@ jobs: run: while [ $((curl localhost:7474/ > /dev/null 2>&1); echo $?) -ne 0 ]; do sleep 1; done - name: Setup test rails app - run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - # For pull requests, get the SHA of the last commit in the PR - COMMIT_SHA=$(jq -r '.pull_request.head.sha' < "${{ github.event_path }}") - else - # For push events (like master branch), use the commit SHA - COMMIT_SHA="${{ github.sha }}" - fi - ./e2e_tests/setup.sh $COMMIT_SHA + run: e2e_tests/setup.sh - name: Install dependencies run: bundle update From 611e98276c523fc5c4a2624296c24f90af8c10c6 Mon Sep 17 00:00:00 2001 From: Hardik Joshi Date: Wed, 25 Sep 2024 18:46:11 +0530 Subject: [PATCH 13/13] activegraph path cleanup --- .github/workflows/e2e_test.yml | 1 - e2e_tests/setup.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index d4fa0f064..7ad1154a1 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -24,7 +24,6 @@ jobs: java-version: 17 env: ACTIVE_MODEL_VERSION: ${{ matrix.active_model }} - ACTIVEGRAPH_PATH: ../ JRUBY_OPTS: --debug -J-Xmx1280m -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF steps: - name: Start neo4j diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index b05992bcf..0fe70e57b 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -5,7 +5,7 @@ rm -r ./myapp gem install rails -v $ACTIVE_MODEL_VERSION --no-document -sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp +sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: '"'"'../'"'"'|' docs/activegraph.rb > template.tmp rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp rm -f ./template.tmp