Skip to content

Commit

Permalink
test(integration): Add scaffold for running integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak committed Jun 30, 2020
1 parent 97d9b98 commit 57cc07e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,27 @@ jobs:
- name: Verify generated code
run: GOPATH="$(go env GOPATH)" ./hack/verify-codegen.sh
- name: Run unit tests
run: make test
run: make unit-tests
- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/setup-kind@v0.4.0
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
echo $HOME
- name: Run integration tests
run: |
echo $HOME
pwd
make integration-tests
./bin/starboard version
ls -R
env:
KUBECONFIG: /home/runner/.kube/config
- name: Release snapshot
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0
- name: Run unit tests
run: make test
run: make unit-tests
- name: Release
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ build: starboard
$(BINARY): $(SOURCES)
CGO_ENABLED=0 go build -o ./bin/$(BINARY) ./cmd/starboard/main.go

test: $(SOURCES)
unit-tests: $(SOURCES)
go test -v -short -race -timeout 30s -coverprofile=coverage.txt -covermode=atomic ./...

integration-tests: build
go test -v test/integration_test.go
14 changes: 14 additions & 0 deletions test/integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package test

import (
"os"
"testing"
)

func TestIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Integration test")
}

t.Logf("Kubeconfig: %v", os.Getenv("KUBECONFIG"))
}

0 comments on commit 57cc07e

Please sign in to comment.