This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce E2E tests execution GH workflow (#14)
- Loading branch information
1 parent
f5cd839
commit 4952b70
Showing
6 changed files
with
92 additions
and
140 deletions.
There are no files selected for viewing
This file contains 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,40 @@ | ||
name: E2E tests | ||
on: # yamllint disable-line rule:truthy | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
workflow_call: | ||
outputs: | ||
workflow_output: | ||
description: "E2E output" | ||
value: ${{ jobs.execution.outputs.run_e2e_failure }} | ||
|
||
jobs: | ||
execution: | ||
runs-on: ubuntu-latest | ||
env: | ||
CI_VERBOSE: true | ||
outputs: | ||
e2e_output_failure: ${{ steps.run_e2e_failure.outputs.test_output }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run tests | ||
run: make e2e-tests | ||
|
||
- name: Run tests failed | ||
if: failure() | ||
id: run_e2e_failure | ||
run: echo "test_output=false" >> $GITHUB_OUTPUT | ||
|
||
# TODO: Uncomment when we establish writing to log files in E2E framework | ||
# - name: Archive test logs | ||
# if: always() | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: e2e-logs | ||
# path: e2e-logs-*/ | ||
# retention-days: 30 |
This file contains 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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,39 @@ | ||
package test | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
) | ||
|
||
// testCluster represents abstraction that enables Docker containers management | ||
type testCluster struct { | ||
path string | ||
} | ||
|
||
// newTestCluster is a constructor function for testCluster instance | ||
func newTestCluster(path string) (*testCluster, error) { | ||
if path == "" { | ||
workDir, err := os.Getwd() | ||
if err != nil { | ||
return nil, err | ||
} | ||
path = filepath.Dir(workDir) | ||
} | ||
|
||
if err := os.Chdir(path); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &testCluster{path: path}, nil | ||
} | ||
|
||
// start starts required Docker containers | ||
func (t *testCluster) start() ([]byte, error) { | ||
return exec.Command("make", "run-docker").CombinedOutput() | ||
} | ||
|
||
// stop stop and destroys running Docker containers | ||
func (t *testCluster) stop() ([]byte, error) { | ||
return exec.Command("make", "destroy-docker").CombinedOutput() | ||
} |