Skip to content

Commit

Permalink
Add testing for the patch system (#8303)
Browse files Browse the repository at this point in the history
We test actually applying all of our real patches on release branches,
but this adds testing on the master branch of the patch system itself.

It works in basically the same way as our inplace upgrade tests: by
creating a database, and then applying a diff that makes some
synthetic testing changes to the server/compiler.

I (re)discovered some various frustrating limitations of the patch
system
while doing this, but haven't fixed those yet.

Fixes #5804.
  • Loading branch information
msullivan authored Feb 5, 2025
1 parent cf887e3 commit 15de3c6
Show file tree
Hide file tree
Showing 4 changed files with 707 additions and 6 deletions.
17 changes: 14 additions & 3 deletions .github/workflows.src/tests-inplace.tpl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% from "tests.inc.yml" import build, calc_cache_key, restore_cache -%>

name: Tests of in-place upgrades
name: Tests of in-place upgrades and patching

on:
schedule:
Expand All @@ -22,7 +22,7 @@ jobs:
<< calc_cache_key()|indent >>
<%- endcall %>

test:
test-inplace:
runs-on: ubuntu-latest
needs: build
strategy:
Expand All @@ -47,12 +47,23 @@ jobs:
run: |
./tests/inplace-testing/test.sh ${{ matrix.flags }} vt ${{ matrix.tests }}
test-patches:
runs-on: ubuntu-latest
needs: build
steps:
<<- restore_cache() >>

- name: Test performing in-place upgrades
run: |
./tests/patch-testing/test.sh test-dir -k test_link_on_target_delete -k test_edgeql_select -k test_edgeql_scope -k test_dump
workflow-notifications:
if: failure() && github.event_name != 'pull_request'
name: Notify in Slack on failures
needs:
- build
- test
- test-inplace
- test-patches
runs-on: ubuntu-latest
permissions:
actions: 'read'
Expand Down
168 changes: 165 additions & 3 deletions .github/workflows/tests-inplace.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions tests/patch-testing/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash -ex

while [[ $# -gt 0 ]]; do
case $1 in
--save-tarballs)
SAVE_TARBALLS=1
shift
;;
*)
break
;;
esac
done


DIR="$1"
shift

if ! git diff-index --quiet HEAD --; then
set +x
echo Refusing to run patching upgrade test with dirty git state.
echo "(The test makes local modifications.)"
exit 1
fi

make parsers

# Setup the test database
edb inittestdb -D "$DIR" "$@"


if [ "$SAVE_TARBALLS" = 1 ]; then
tar cf "$DIR".tar "$DIR"
fi


# Upgrade to the new version
patch -f -p1 < tests/patch-testing/upgrade.patch
make parsers

edb server --bootstrap-only --data-dir "$DIR"

if [ "$SAVE_TARBALLS" = 1 ]; then
tar cf "$DIR"-upgraded.tar "$DIR"
fi

# Test!
edb test --data-dir "$DIR" --use-data-dir-dbs -v "$@"
Loading

0 comments on commit 15de3c6

Please sign in to comment.