Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/usr/bin/env clitest --v0

$ gel instance destroy -I watch_test --force
$ gel instance destroy -I watch_test0 --force
%EXIT any
*

using tempdir;

using new dir "watch_test";
using new dir "watch_test0";

$ gel project init --instance=watch_test --non-interactive
$ gel project init --instance=watch_test0 --non-interactive
*

# Create another branch for tests
$ gel branch create other
*

$ find .
Expand All @@ -21,16 +25,47 @@ background {
}

background {
$ gel instance logs -I watch_test --follow --tail 10
$ gel instance logs -I watch_test0 --follow --tail 10
%EXIT any
*
}

# Give it a second to start up
$ sleep 1

# Project is locked, so we can't switch to another branch
$ gel branch switch --create --empty other
# Cannot start another watch for the same project
$ gel watch --migrate
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

# Project is locked, so we can't manipulate branches
$ gel branch switch other
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel branch switch --create --empty foo
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel branch wipe main
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel branch rebase other
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel branch merge other
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel branch drop other
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}
Expand Down Expand Up @@ -108,3 +143,14 @@ $ sleep 1
$ gel query "select schema::Migration {*} filter .generated_by =
schema::MigrationGeneratedBy.DevMode;"
*

# Project is locked, so we can't overwrite the migrations
$ gel migration extract
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}

$ gel migration edit
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}
39 changes: 39 additions & 0 deletions tests/scripts/project/watch1.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env clitest --v0

$ gel instance destroy -I watch_test1 --force
%EXIT any
*

using tempdir;

using new dir "watch_test1";

$ gel project init --instance=watch_test1 --non-interactive
*

$ find .
*

background {
$ gel watch --migrate --verbose
%EXIT any
*
}

background {
$ gel instance logs -I watch_test1 --follow --tail 10
%EXIT any
*
}

# Give it a second to start up
$ sleep 1

$ gel instance backup -I watch_test1 --non-interactive
*

# Project is locked, so we can't manipulate branches
$ gel instance restore -I test --latest --non-interactive
%EXIT 1
*
! gel error: Could not acquire lock %{GREEDYDATA}
56 changes: 56 additions & 0 deletions tests/scripts/project/watch2.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env clitest --v0

$ gel instance destroy -I watch_test2 --force
%EXIT any
*

using tempdir;

using new dir "watch_test2";

$ gel project init --instance=watch_test2 --non-interactive
*

$ find .
*

# Create a git repo for tests
$ git init -b main
*

$ git add dbschema
*

$ git commit -m 'Empty schema'
*

$ git checkout -b user
*

$ echo "module test {
type User {
name: str;
}
}" > dbschema/default.gel
*

$ git add dbschema/default.gel
*

$ git commit -m 'Add User'
*

background {
$ gel watch --migrate --verbose
%EXIT 1
*
! gel error: Current git branch (main) is different from the branch used to start watch mode (user), exiting.
}

# Give it a second to start up
$ sleep 1

$ git checkout main
*

$ sleep 5
Loading