Skip to content

Commit aa358f6

Browse files
Merge branch 'main' of github.com:kosli-dev/cli into install-script
2 parents b08d045 + e811c5a commit aa358f6

7 files changed

Lines changed: 43 additions & 30 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ jobs:
221221

222222
evidence-reporter-upload-package-and-deploy:
223223
needs: [pre-build, goreleaser]
224-
runs-on: ubuntu-20.04
224+
runs-on: ubuntu-latest
225225
steps:
226226
- name: Repository Dispatch
227227
uses: peter-evans/repository-dispatch@v2
@@ -233,7 +233,7 @@ jobs:
233233

234234
environment-reporter-upload-package-and-deploy:
235235
needs: [pre-build, goreleaser]
236-
runs-on: ubuntu-20.04
236+
runs-on: ubuntu-latest
237237
steps:
238238
- name: Repository Dispatch
239239
uses: peter-evans/repository-dispatch@v2

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ test_setup_restart_server: ensure_gotestsum
8282
@test -f /tmp/server-image.txt || ./hack/get-server-image.sh /tmp/server-image.txt
8383
export KOSLI_SERVER_IMAGE=$$(cat /tmp/server-image.txt) && ./bin/reset-or-start-server.sh force
8484

85+
setup_test_to_use_local_image:
86+
@echo merkely > /tmp/server-image.txt
87+
@docker ps -aq | xargs -r docker rm -fv
88+
@echo "Run make build in the server repo you want to use"
89+
@echo "Then run make test_integration"
90+
@echo "To look at the logs from local kosli server run: make follow_integration_test_server"
91+
92+
setup_test_to_use_staging_server_image:
93+
@rm /tmp/server-image.txt
94+
@docker ps -aq | xargs -r docker rm -fv
95+
@echo "Now run make test_integration"
96+
@echo "To look at the logs from kosli server run: make follow_integration_test_server"
97+
8598
test_integration: deps vet ensure_network test_setup ## Run tests except the too slow ones
8699
@[ -e ~/.kosli.yml ] && mv ~/.kosli.yml ~/.kosli-renamed.yml || true
87100
@export KOSLI_TESTS=true && $(GOTESTSUM) -- --short -p=8 -coverprofile=cover.out ./...
@@ -110,6 +123,12 @@ test_integration_single: test_setup
110123
test_docs: deps vet ensure_network test_setup
111124
./bin/test_docs_cmds.sh docs.kosli.com/content/use_cases/simulating_a_devops_system/_index.md
112125

126+
logs_integration_test_server:
127+
@docker logs cli_kosli_server ${CONTAINER} 2>&1
128+
129+
follow_integration_test_server:
130+
@docker logs cli_kosli_server -f ${CONTAINER} 2>&1
131+
113132

114133
docker:
115134
@docker build -t kosli-cli .

cmd/kosli/createEnvironment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (suite *CreateEnvironmentCommandTestSuite) TestCreateEnvironmentCmd() {
100100
wantError: true,
101101
name: "fails when name is considered invalid by the server",
102102
cmd: "create env 'foo bar' --type K8S" + suite.defaultKosliArguments,
103-
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_~]*$']\n",
103+
golden: "Error: Input payload validation failed: map[name:'foo bar' does not match '^[a-zA-Z0-9][a-zA-Z0-9\\\\.\\\\-_]*$']\n",
104104
},
105105
{
106106
wantError: false,

cmd/kosli/multiHost.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func runMultiHost(args []string) (string, error) {
5959
errorMessage += err0.Error()
6060
}
6161

62-
for i:=1; i < len(opts.hosts); i++ {
62+
for i := 1; i < len(opts.hosts); i++ {
6363
argsN := argsAppendHostApiTokenFlags(i)
6464
outputN, errN := runBufferedInnerMain(argsN)
6565

@@ -75,7 +75,7 @@ func runMultiHost(args []string) (string, error) {
7575
errorMessage += fmt.Sprintf("\n%s", errN.Error())
7676
}
7777
}
78-
78+
7979
var err error
8080
if errorMessage != "" {
8181
err = errors.New(errorMessage)

cmd/kosli/multiHost_test.go

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func (suite *MultiHostTestSuite) TestRunDoubledHost() {
121121
stdOut: []string{"OK", ""},
122122
err: error(nil),
123123
},
124-
125124
} {
126125
defer func(original []string) { os.Args = original }(os.Args)
127126
os.Args = t.args
@@ -157,7 +156,6 @@ func (suite *MultiHostTestSuite) TestRunTripledHost() {
157156
stdOut: []string{"OK", ""},
158157
err: error(nil),
159158
},
160-
161159
} {
162160
defer func(original []string) { os.Args = original }(os.Args)
163161
os.Args = t.args
@@ -261,21 +259,21 @@ func charAt(s string, n int) string {
261259
return fmt.Sprintf("%v", c)
262260
}
263261

264-
// {
265-
// name: "in debug mode also returns secondary call output",
266-
// args: doubledArgs([]string{"kosli", "status", "--debug"}),
267-
// stdOut: StatusDebugLines(),
268-
// err: error(nil),
269-
// },
270-
// {
271-
// name: "--help prints output once",
272-
// args: doubledArgs([]string{"kosli", "status", "--help"}),
273-
// stdOut: HelpStatusLines(),
274-
// err: error(nil),
275-
// },
276-
// {
277-
// name: "bad-flag never gets to call runMultiHost() because isMultiHost() returns false",
278-
// args: doubledArgs([]string{"kosli", "status", "--bad-flag"}),
279-
// stdOut: BadFlagLines(),
280-
// err: error(nil),
281-
// },
262+
// {
263+
// name: "in debug mode also returns secondary call output",
264+
// args: doubledArgs([]string{"kosli", "status", "--debug"}),
265+
// stdOut: StatusDebugLines(),
266+
// err: error(nil),
267+
// },
268+
// {
269+
// name: "--help prints output once",
270+
// args: doubledArgs([]string{"kosli", "status", "--help"}),
271+
// stdOut: HelpStatusLines(),
272+
// err: error(nil),
273+
// },
274+
// {
275+
// name: "bad-flag never gets to call runMultiHost() because isMultiHost() returns false",
276+
// args: doubledArgs([]string{"kosli", "status", "--bad-flag"}),
277+
// stdOut: BadFlagLines(),
278+
// err: error(nil),
279+
// },

cmd/kosli/renameEnvironment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (suite *RenameEnvironmentCommandTestSuite) TestRenameEnvironmentCmd() {
3939
wantError: true,
4040
name: "renaming environment fails if the new name is illegal",
4141
cmd: fmt.Sprintf(`rename environment %s 'new illegal name' %s`, suite.envName, suite.defaultKosliArguments),
42-
golden: "Error: 'new illegal name' is an invalid name for environments. Valid names should start with an alphanumeric and only contain alphanumeric characters, '.', '-', '_' and '~'.\n",
42+
golden: "Error: 'new illegal name' is an invalid name for environments. Valid names should start with an alphanumeric and only contain alphanumeric characters, '.', '-' and '_'.\n",
4343
},
4444
{
4545
wantError: true,

docs.kosli.com/layouts/partials/docs/html-head.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@
6868
<script defer src="{{ $swJS.RelPermalink }}" {{ template "integrity" $swJS }}></script>
6969
{{ end -}}
7070

71-
<!-- Fathom - beautiful, simple website analytics -->
72-
<script src="https://cdn.usefathom.com/script.js" data-site="AUFUAQWT" data-excluded-domains="localhost" defer></script>
73-
<!-- / Fathom -->
74-
7571
{{ if in .Permalink "/legacy_ref" }}
7672
<meta name="robots" content="noindex">
7773
{{ end }}

0 commit comments

Comments
 (0)