Merge pull request #329 from dagger/bats-gh-action

tests: improve bats/gh integration
This commit is contained in:
Andrea Luzzardi 2021-04-15 01:25:19 -07:00 committed by GitHub
commit 0f22f07c3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 12 deletions

View File

@ -42,6 +42,23 @@ jobs:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.16
- name: Test
run: |
make test
integration:
name: Integration
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@v2
@ -69,10 +86,14 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Test
run: |
make test
- name: Integration test
run: |
make integration
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
if: always()
with:
report_paths: "tests/*.xml"
github_token: ${{ secrets.GITHUB_TOKEN }}
check_name: "Report"

1
.gitignore vendored
View File

@ -12,6 +12,7 @@
# Test binary, build with `go test -c`
*.test
tests/report.xml
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

View File

@ -116,13 +116,18 @@ func startBuildkit(ctx context.Context) error {
)
output, err = cmd.CombinedOutput()
if err != nil {
log.
Ctx(ctx).
Error().
Err(err).
Bytes("output", output).
Msg("unable to start buildkitd")
return err
// If the daemon failed to start because it's already running,
// chances are another dagger instance started it. We can just ignore
// the error.
if !strings.Contains(string(output), "Error response from daemon: Conflict.") {
log.
Ctx(ctx).
Error().
Err(err).
Bytes("output", output).
Msg("unable to start buildkitd")
return err
}
}
return waitBuildkit(ctx)
}

View File

@ -7,6 +7,9 @@ common_setup() {
DAGGER="${DAGGER_BINARY:-$TESTDIR/../cmd/dagger/dagger}"
export DAGGER
DAGGER_LOG_FORMAT="pretty"
export DAGGER_LOG_FORMAT
DAGGER_STORE="$(mktemp -d -t dagger-store-XXXXXX)"
export DAGGER_STORE
}

View File

@ -1,7 +1,7 @@
{
"license": "Apache-2.0",
"scripts": {
"test": "bats ."
"test": "bats --report-formatter junit ."
},
"devDependencies": {
"bats": "https://github.com/bats-core/bats-core.git",