Skip to content

fix: test flakiness from nondeterministic waiting #13

fix: test flakiness from nondeterministic waiting

fix: test flakiness from nondeterministic waiting #13

Workflow file for this run

# This workflow is a collection of "quick checks" that should be reasonable
# to run for any new commit to this repository in principle.
#
# The main purpose of this workflow is to represent checks that we want to
# run prior to reviewing and merging a pull request. We should therefore aim
# for these checks to complete in no more than a few minutes in the common
# case.
#
# The build.yml workflow includes some additional checks we run only for
# already-merged changes to release branches and tags, as a compromise to
# keep the PR feedback relatively fast. The intent is that checks.yml should
# catch most problems but that build.yml might occasionally by the one to catch
# more esoteric situations, such as architecture-specific or OS-specific
# misbehavior.
name: Quick Checks
on:
pull_request:
push:
branches:
- main
- 'v[0-9]+.[0-9]+'
- checks-workflow-dev/*
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
# This workflow runs for not-yet-reviewed external contributions and so it
# intentionally has no write access and only limited read access to the
# repository.
permissions:
contents: read
jobs:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
# run 10 times in parallel to try to reproduce the failure
strategy:
fail-fast: false
matrix:
custom1: [ 1, 2, 3, 4, 5 ]
custom2: [ 1, 2, 3 ]
steps:
- name: "Fetch source code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Determine Go version
id: go
uses: ./.github/actions/go-version
- name: Install Go toolchain
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ steps.go.outputs.version }}
# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-
- name: "Unit tests"
run: |
go test ./...
race-tests:
name: "Race Tests"
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Determine Go version
id: go
uses: ./.github/actions/go-version
- name: Install Go toolchain
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ steps.go.outputs.version }}
# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-
# The race detector add significant time to the unit tests, so only run
# it for select packages.
- name: "Race detector"
run: |
go test -race ./internal/tofu ./internal/command ./internal/states
e2e-tests:
# This is an intentionally-limited form of our E2E test run which only
# covers OpenTofu running on Linux. The build.yml workflow runs these
# tests across various other platforms in order to catch the rare exception
# that might leak through this.
name: "End-to-end Tests"
runs-on: ubuntu-latest
steps:
- name: "Fetch source code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Determine Go version
id: go
uses: ./.github/actions/go-version
- name: Install Go toolchain
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ steps.go.outputs.version }}
# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-
- name: "End-to-end tests"
run: |
TF_ACC=1 go test -v ./internal/command/e2etest
# consistency-checks:
# name: "Code Consistency Checks"
# runs-on: ubuntu-latest
#
# steps:
# - name: "Fetch source code"
# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# with:
# fetch-depth: 0 # We need to do comparisons against the main branch.
#
# - name: Determine Go version
# id: go
# uses: ./.github/actions/go-version
#
# - name: Install Go toolchain
# uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version: ${{ steps.go.outputs.version }}
#
# # NOTE: This cache is shared so the following step must always be
# # identical across the unit-tests, e2e-tests, and consistency-checks
# # jobs, or else weird things could happen.
# - name: Cache Go modules
# uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
# with:
# path: "~/go/pkg"
# key: go-mod-${{ hashFiles('go.sum') }}
# restore-keys: |
# go-mod-
#
# - name: "go.mod and go.sum consistency check"
# run: |
# go mod tidy
# if [[ -n "$(git status --porcelain)" ]]; then
# echo >&2 "ERROR: go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files."
# exit 1
# fi
#
# - name: Cache protobuf tools
# uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
# with:
# path: "tools/protobuf-compile/.workdir"
# key: protobuf-tools-${{ hashFiles('tools/protobuf-compile/protobuf-compile.go') }}
# restore-keys: |
# protobuf-tools-
#
# - name: "Code consistency checks"
# run: |
# make fmtcheck importscheck generate staticcheck exhaustive protobuf
# if [[ -n "$(git status --porcelain)" ]]; then
# echo >&2 "ERROR: Generated files are inconsistent. Run 'make generate' and 'make protobuf' locally and then commit the updated files."
# git >&2 status --porcelain
# exit 1
# fi
#
# license-checks:
# name: "License Checks"
# runs-on: ubuntu-latest
#
# steps:
# - name: "Fetch source code"
# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
#
# - name: Install licensei
# run: |
# make deps
#
# - name: Restore cache license information of dependencies
# uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
# with:
# path: ".licensei.cache"
# key: licensei-cache-${{ hashFiles('go.sum') }}
# restore-keys: |
# licensei-cache-
#
# - name: Determine Go version
# id: go
# uses: ./.github/actions/go-version
#
# - name: Install Go toolchain
# uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version: ${{ steps.go.outputs.version }}
#
# - name: Run licensei
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# make license-check
# if: env.LICENSE_CHECK != 'false'
#
# - name: Save cache license information of dependencies
# uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
# if: always()
# with:
# path: ".licensei.cache"
# key: licensei-cache-${{ hashFiles('go.sum') }}
# installation-instructions:
# name: "Test Installation Instructions"
# runs-on: ubuntu-latest
#
# steps:
# - name: "Fetch source code"
# uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
#
# - name: "Run Installation Instructions Test"
# run: make test-linux-install-instructions