Skip to content

Commit

Permalink
Add ui for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thokra-nav committed Nov 5, 2024
1 parent 687da18 commit 88c0d4a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ start-integration-test-db: stop-integration-test-db
integration_test:
rm -f hack/coverprofile.txt
go test -coverprofile=hack/coverprofile.txt -coverpkg github.com/nais/api/... -v -tags integration_test --race ./integration_tests
# go test -coverprofile=hack/coverprofile.txt -coverpkg $(shell go list --deps ./cmd/api | grep nais/api/ | grep -Ev 'gengqlv1|/(\w+)/\1sql' | tr '\n' ',' | sed '$$s/,$$//') -v -tags integration_test --race ./integration_tests

integration_test_ui:
go run ./cmd/tester_run --ui

tester_spec:
go run ./cmd/tester_spec
Expand Down
12 changes: 10 additions & 2 deletions cmd/tester_run/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

func main() {
dir := filepath.Join(".", "integration_tests")
ui := false
flag.BoolVar(&ui, "ui", ui, "run with UI")
flag.StringVar(&dir, "d", dir, "write spec to this directory")
flag.Parse()

Expand All @@ -25,7 +27,13 @@ func main() {
panic(err)
}

if err := mgr.Run(ctx, dir, lua.NewJSONReporter(os.Stdout)); err != nil {
panic(err)
if ui {
if err := mgr.RunUI(ctx, dir); err != nil {
panic(err)
}
} else {
if err := mgr.Run(ctx, dir, lua.NewJSONReporter(os.Stdout)); err != nil {
panic(err)
}
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/nais/bifrost v0.0.0-20240521085955-c2d2e61bfcd0
github.com/nais/dependencytrack v0.0.0-20240610080458-c76185696c11
github.com/nais/liberator v0.0.0-20240704120107-2f372679d62b
github.com/nais/tester v0.1.0-pre.7
github.com/nais/tester v0.1.0-pre.8
github.com/nais/unleasherator v0.0.0-20240513081022-06f454638fc1
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pressly/goose/v3 v3.21.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,12 @@ github.com/nais/dependencytrack v0.0.0-20240610080458-c76185696c11 h1:2Cy7cjTM7P
github.com/nais/dependencytrack v0.0.0-20240610080458-c76185696c11/go.mod h1:BdPp1+tyE1hSMZigr7aGmhcTqaksf9Pxxbo4ZAi4On8=
github.com/nais/liberator v0.0.0-20240704120107-2f372679d62b h1:mkMfksGzL0ys5L2V36CjvcN46VlfjzB6FdgsY0uh488=
github.com/nais/liberator v0.0.0-20240704120107-2f372679d62b/go.mod h1:bgMXRBuJtuEgSQlSCgjbUh58Jy93f2Zl4LH1iuIIm0w=
github.com/nais/tester v0.0.1 h1:MQ8F8gd6QT085AvHl9lppU4xceiUXkHenJ6qDdZyg7A=
github.com/nais/tester v0.0.1/go.mod h1:uRAGK4W74/pBxHgJmMQ2HBw2pUazBt7JT1wAUPqfv08=
github.com/nais/tester v0.1.0-pre.7 h1:0n4lF8MXyUGS/U+wJ3oQGqX8dc/zL5SlqXkCaWX/Zkw=
github.com/nais/tester v0.1.0-pre.7/go.mod h1:8OOc6PiMrRIFnRbpi5nZl4kbSav5v2hk6T7fHsJ6bF4=
github.com/nais/tester v0.1.0-pre.8 h1:rNARIFM1HOJBU0CtY+9s7RlzeticF6T5Zr5dikKbRHI=
github.com/nais/tester v0.1.0-pre.8/go.mod h1:c1pUID56MwTXhy94KEa0QkLv1E42LsB9ScJXfocpeT0=
github.com/nais/unleasherator v0.0.0-20240513081022-06f454638fc1 h1:Ei6o4MzKnaGys+uVHNcZd1ttV9lcmHGX3whH1GyPV8E=
github.com/nais/unleasherator v0.0.0-20240513081022-06f454638fc1/go.mod h1:p5j21mYqhbtfQeTqs6lHgsuaL28tY5oNNf1r+gADFe0=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/zz_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


--- Ensure the field contains a substring
---@param substr string The contained string
---@param contains string The contained string
---@param caseSensitive? boolean Whether to do a case sensitive check. Defaults to true
---@return userdata
function Contains(contains, caseSensitive)
Expand Down

0 comments on commit 88c0d4a

Please sign in to comment.