-
Notifications
You must be signed in to change notification settings - Fork 1
feat: [E2E] Parallel E2E tests, devstack cmd, and CI workflow #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6baef1a
indexer e2e test
sadiq1971 28fb2d4
optimized implementations
sadiq1971 b88c69e
fixed failing tests
sadiq1971 4f5893a
revert unused changes
sadiq1971 815e83f
bug fixes and improvements
sadiq1971 cf8b078
unit test fixed
sadiq1971 4e52b0d
parrlale test support and bug fix
sadiq1971 0ddc7bd
parrlale test support and bug fix
sadiq1971 bf8a2ec
workflow for e2e test
sadiq1971 e48dfa0
fix: add E2E workflow, remove devstack binary from tracking
sadiq1971 a69cdb2
fix: generate CANTON_MASTER_KEY in CI instead of reading from secret
sadiq1971 2b609a4
fix: add context to devstack cmd and fix gofmt formatting
sadiq1971 3c83fa5
fix: add Docker Hub login to e2e workflow and fix mnd lint in dsl.go
sadiq1971 f544bd1
build docker image for canton
sadiq1971 9cbe717
add pat for git clone private repo
sadiq1971 fbbe42c
typo fixed
sadiq1971 dabd264
fixed workflow
sadiq1971 51bee32
fixed workflow
sadiq1971 11dbf9c
fix(e2e): deployer remappings and log capture on failure
sadiq1971 f6a13af
fix(e2e): run deployer as root to fix volume write permissions
sadiq1971 fbe4aa7
fix(e2e): remove double blank line in helpers.go to pass gofmt lint
sadiq1971 db3a4fd
fix(e2e): address PR review comments
sadiq1971 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'cmd/**' | ||
| - 'pkg/**' | ||
| - 'tests/e2e/**' | ||
| - '.github/workflows/e2e.yml' | ||
| - 'docker-compose.yaml' | ||
| - 'Makefile' | ||
| - 'contracts/**' | ||
| - 'go.mod' | ||
| - 'go.sum' | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| repository-projects: read | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: E2E Tests | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| steps: | ||
| - name: Configure git SSH to HTTPS rewrite | ||
| # canton-erc20 and ethereum-wayfinder submodules use SSH URLs (git@github.com:). | ||
| # actions/checkout cannot authenticate SSH URLs via its token: input, so we | ||
| # rewrite them to HTTPS globally before the recursive submodule checkout. | ||
| run: git config --global url."https://${{ secrets.GH_PAT }}@github.com/".insteadOf "git@github.com:" | ||
|
sadiq1971 marked this conversation as resolved.
|
||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| token: ${{ secrets.GH_PAT }} | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.24" | ||
| cache: true | ||
|
|
||
| - name: Checkout canton-docker repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: chainsafe/canton-docker | ||
| token: ${{ secrets.GH_PAT }} | ||
| path: canton-docker | ||
|
|
||
| - name: Build Canton Docker image | ||
| run: | | ||
| cd canton-docker | ||
| ./build_contianer.sh | ||
|
|
||
| - name: Download dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Install Daml SDK | ||
| run: | | ||
| curl -sSL https://get.daml.com/ | sh -s -- 3.4.8 | ||
| echo "$HOME/.daml/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Build DAML contracts | ||
| run: make build-dars | ||
|
|
||
| - name: Generate CANTON_MASTER_KEY | ||
| run: echo "CANTON_MASTER_KEY=$(openssl rand -base64 32)" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Run E2E tests | ||
| run: make test-e2e | ||
|
|
||
| - name: Stop devstack | ||
| if: always() | ||
| run: make devstack-down | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,3 +126,4 @@ docker-compose.remote.yaml | |
|
|
||
| # Binary output from demo | ||
| interop-demo | ||
| /devstack | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| // devstack manages the Docker Compose devstack lifecycle for E2E tests. | ||
| // | ||
| // Usage: | ||
| // | ||
| // go run ./tests/e2e/cmd/devstack <up|down> | ||
| // | ||
| // up Starts the E2E devstack and waits for all services to be healthy. | ||
| // | ||
| // Sets SKIP_CANTON_SIG_VERIFY=true so Canton native registration tests | ||
| // work without a real Loop wallet signature. | ||
| // | ||
| // down Tears down the E2E devstack and removes all volumes. | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "os/exec" | ||
| "strings" | ||
| ) | ||
|
|
||
| const ( | ||
| composeFile = "tests/e2e/docker-compose.e2e.yaml" | ||
| projectName = "canton-e2e" | ||
| ) | ||
|
|
||
| func main() { | ||
| if len(os.Args) != 2 { | ||
| fmt.Fprintf(os.Stderr, "usage: devstack <up|down>\n") | ||
| os.Exit(1) | ||
| } | ||
| ctx := context.Background() | ||
| var err error | ||
| switch os.Args[1] { | ||
| case "up": | ||
| err = up(ctx) | ||
| case "down": | ||
| err = down(ctx) | ||
| default: | ||
| fmt.Fprintf(os.Stderr, "unknown subcommand %q: want up or down\n", os.Args[1]) | ||
| os.Exit(1) | ||
| } | ||
| if err != nil { | ||
| fmt.Fprintf(os.Stderr, "devstack %s: %v\n", os.Args[1], err) | ||
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| func up(ctx context.Context) error { | ||
| if err := compose(ctx, upEnv(), | ||
| "up", "--build", "--wait", "--remove-orphans", | ||
| ); err != nil { | ||
| fmt.Fprintln(os.Stderr, "=== deployer logs ===") | ||
| _ = compose(ctx, os.Environ(), "logs", "--no-color", "deployer") | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func down(ctx context.Context) error { | ||
| return compose(ctx, os.Environ(), | ||
| "down", "-v", "--remove-orphans", | ||
| ) | ||
| } | ||
|
|
||
| // upEnv returns the host environment with SKIP_CANTON_SIG_VERIFY forced to | ||
| // "true" so that Canton native registration tests work in the devnet. | ||
| func upEnv() []string { | ||
| const key = "SKIP_CANTON_SIG_VERIFY" | ||
| env := os.Environ() | ||
| for i, e := range env { | ||
| if strings.HasPrefix(e, key+"=") { | ||
| env[i] = key + "=true" | ||
| return env | ||
| } | ||
| } | ||
| return append(env, key+"=true") | ||
| } | ||
|
|
||
| func compose(ctx context.Context, env []string, args ...string) error { | ||
| // #nosec G204 -- args are fixed constants from this file, not user input. | ||
| cmd := exec.CommandContext(ctx, "docker", append([]string{ | ||
| "compose", "-f", composeFile, "-p", projectName, | ||
| }, args...)...) | ||
| cmd.Stdout = os.Stderr | ||
| cmd.Stderr = os.Stderr | ||
| cmd.Env = env | ||
| return cmd.Run() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.