Skip to content

Commit

Permalink
Fixed some tests, updated Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ToreMerkely committed Oct 10, 2024
1 parent 82993c9 commit 73ee92a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,25 @@ test_setup_restart_server: ensure_gotestsum
./bin/reset-or-start-server.sh force

test_integration: deps vet ensure_network test_setup ## Run tests except the too slow ones
@mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@[ -e ~/.kosli.yml ] && mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@export KOSLI_TESTS=true && $(GOTESTSUM) -- --short -p=8 -coverprofile=cover.out ./...
@go tool cover -func=cover.out | grep total:
@go tool cover -html=cover.out
@mv ~/.kosli-renamed.yml ~/.kosli.yml || true
@[ -e ~/.kosli-renamed.yml ] && mv ~/.kosli-renamed.yml ~/.kosli.yml || true


test_integration_full: deps vet ensure_network test_setup ## Run all tests
@mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@[ -e ~/.kosli.yml ] && mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@export KOSLI_TESTS=true && $(GOTESTSUM) --junitfile junit.xml -- -p=8 -coverprofile=cover.out ./...
@go tool cover -func=cover.out
@mv ~/.kosli-renamed.yml ~/.kosli.yml || true
@[ -e ~/.kosli-renamed.yml ] && mv ~/.kosli-renamed.yml ~/.kosli.yml || true


test_integration_restart_server: test_setup_restart_server
@mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@[ -e ~/.kosli.yml ] && mv ~/.kosli.yml ~/.kosli-renamed.yml || true
@export KOSLI_TESTS=true && $(GOTESTSUM) -- --short -p=8 -coverprofile=cover.out ./...
@go tool cover -html=cover.out
@mv ~/.kosli-renamed.yml ~/.kosli.yml || true
@[ -e ~/.kosli-renamed.yml ] && mv ~/.kosli-renamed.yml ~/.kosli.yml || true

test_integration_single: test_setup
@export KOSLI_TESTS=true && $(GOTESTSUM) -- -p=1 ./... -run "${TARGET}"
Expand Down
4 changes: 2 additions & 2 deletions cmd/kosli/createEnvironment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ func (suite *CreateEnvironmentCommandTestSuite) TestCreateEnvironmentCmd() {
{
wantError: true,
name: "fails when name is considered invalid by the server",
cmd: "create env foo_bar --type K8S" + suite.defaultKosliArguments,
golden: "Error: Input payload validation failed: map[name:'foo_bar' does not match '^[a-zA-Z][a-zA-Z0-9\\\\-]*$']\n",
cmd: "create env 'foo bar' --type K8S" + suite.defaultKosliArguments,
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_~]*$']\n",
},
{
wantError: false,
Expand Down
4 changes: 2 additions & 2 deletions cmd/kosli/createFlow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (suite *CreateFlowCommandTestSuite) TestCreateFlowCmd() {
{
wantError: true,
name: "fails when name is considered invalid by the server",
cmd: "create flow foo_bar" + suite.defaultKosliArguments,
golden: "Error: Input payload validation failed: map[name:'foo_bar' does not match '^[a-zA-Z0-9\\\\-\\\\.]+$']\n",
cmd: "create flow 'foo bar'" + suite.defaultKosliArguments,
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_~]*$']\n",
},
{
name: "can create a flow (by default legacy template is used)",
Expand Down
4 changes: 2 additions & 2 deletions cmd/kosli/renameFlow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (suite *RenameFlowCommandTestSuite) TestRenameFlowCmd() {
{
wantError: true,
name: "renaming flow fails if the new name is illegal",
cmd: fmt.Sprintf(`rename flow %s new_illegal_name %s`, suite.flowName, suite.defaultKosliArguments),
golden: "Error: 'new_illegal_name' is an invalid name for flows. Valid names should only contain alphanumeric characters, '.', and '-'.\n",
cmd: fmt.Sprintf(`rename flow %s 'new illegal name' %s`, suite.flowName, suite.defaultKosliArguments),
golden: "Error: 'new illegal name' is an invalid name for flows. Valid names should start with an alphanumeric and only contain alphanumeric characters, '.', '-', '_' and '~'.\n",
},
{
wantError: true,
Expand Down

0 comments on commit 73ee92a

Please sign in to comment.