forked from eclipse-kanto/container-management
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide integration test for the CLI sysinfo, logs and update commands (
eclipse-kanto#125) [eclipse-kanto#119] Provide integration test for the CLI sysinfo, logs and update commands - added integration tests for sysinfo, update and logs CLI commands - implemented custom result function for logs command - fixed stop_invalid_id test Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov3@bosch.io>
- Loading branch information
1 parent
d7afe61
commit 4108c97
Showing
10 changed files
with
291 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Print the logs for a container. | ||
|
||
Usage: | ||
kanto-cm logs <container-id> | ||
|
||
Examples: | ||
logs <container-id> | ||
logs --name <container-name> | ||
logs -n <container-name> | ||
|
||
Flags: | ||
-h, --help help for logs | ||
-n, --name string Print the logs of a container with a specific name. | ||
-t, --tail int32 Lines of recent log file to display. Setting it to -1 will return all logs. (default 100) | ||
|
||
Global Flags: | ||
--debug Switch commands log level to DEBUG mode | ||
--host string Specify the address path to the Eclipse Kanto container management (default "/run/container-management/container-management.sock") | ||
--timeout int Specify the connection timeout in seconds to the Eclipse Kanto container management (default 30) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: logs_help | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "-h"] | ||
expected: | ||
exitCode: 0 | ||
goldenFile: "logs-help.golden" | ||
--- | ||
name: logs_no_args | ||
command: | ||
binary: kanto-cm | ||
args: ["logs"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: You must provide either an ID or a name for the container via --name (-n)" | ||
--- | ||
name: logs_invalid_id | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "invalid"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: The requested container with ID = invalid was not found." | ||
--- | ||
name: logs_invalid_name | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "-n", "invalid"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: The requested container with name = invalid was not found. Try using an ID instead." | ||
--- | ||
name: logs_of_container_with_state_created | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "-n", "test-it"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: rpc error: code = Unknown desc = there are no logs for container with status \"Created\"" | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] | ||
--- | ||
name: logs_of_container_with_state_running | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
- binary: kanto-cm | ||
args: ["start", "-n", "test-it"] | ||
- binary: sleep | ||
args: ["2"] | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "-n", "test-it", "-t", "5"] | ||
expected: | ||
exitCode: 0 | ||
customResult: | ||
type: LOGS_JSON | ||
args: ["5"] | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] | ||
--- | ||
name: logs_of_container_with_state_stopped | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
- binary: kanto-cm | ||
args: ["start", "-n", "test-it"] | ||
- binary: kanto-cm | ||
args: ["stop", "-n", "test-it"] | ||
command: | ||
binary: kanto-cm | ||
args: ["logs", "-n", "test-it"] | ||
expected: | ||
exitCode: 0 | ||
customResult: | ||
type: LOGS_JSON | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Show information about the container management runtime and its environment. | ||
|
||
Usage: | ||
kanto-cm sysinfo | ||
|
||
Examples: | ||
sysinfo | ||
|
||
Flags: | ||
-h, --help help for sysinfo | ||
|
||
Global Flags: | ||
--debug Switch commands log level to DEBUG mode | ||
--host string Specify the address path to the Eclipse Kanto container management (default "/run/container-management/container-management.sock") | ||
--timeout int Specify the connection timeout in seconds to the Eclipse Kanto container management (default 30) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: sysinfo_help | ||
command: | ||
binary: kanto-cm | ||
args: ["sysinfo", "-h"] | ||
expected: | ||
exitCode: 0 | ||
goldenFile: "sysinfo-help.golden" | ||
--- | ||
name: sysinfo | ||
command: | ||
binary: kanto-cm | ||
args: ["sysinfo"] | ||
expected: | ||
exitCode: 0 | ||
customResult: | ||
type: REGEX | ||
args: ["Engine v[^ ]*, API v[^ ]*, \\(build [^ ]* [^ ]*\\) [\\r?\\n]CLI v[^ ]*, API v[^ ]*, \\(build [^ ]* [^ ]*\\) [\\r?\\n]"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Update a container without recreating it. The provided configurations will be merged with the current one. | ||
|
||
Usage: | ||
kanto-cm update <container-id> | ||
|
||
Examples: | ||
update <container-id> | ||
update -n <container-name> | ||
|
||
|
||
Flags: | ||
-h, --help help for update | ||
-m, --memory string Updates the max amount of memory the container can use in the form of 200m, 1.2g. | ||
Use -1, to remove the memory usage limit. | ||
--memory-reservation string Updates the soft memory limitation in the form of 200m, 1.2g. | ||
Use -1, to remove the reservation memory limit. | ||
--memory-swap string Updates the total amount of memory + swap that the container can use in the form of 200m, 1.2g. | ||
Use -1, to remove the swap memory limit. | ||
-n, --name string Updates the container with a specific name. | ||
--rp string Updates the restart policy for the container. The policy will be applied when the container exits. Supported restart policies are - no, always, unless-stopped, on-failure. | ||
no - no attempts to restart the container for any reason will be made | ||
always - an attempt to restart the container will be made each time the container exits regardless of the exit code | ||
unless-stopped - restart attempts will be made only if the container has not been stopped by the user | ||
on-failure - restart attempts will be made if the container exits with an exit code != 0; | ||
the additional flags (--rp-cnt and --rp-to) apply only for this policy; if max retry count is not provided - the system will retry until it succeeds endlessly | ||
|
||
--rp-cnt int Updates the number of retries that will be made to restart the container on exit if the policy is on-failure (default -2147483648) | ||
--rp-to int Updates the time out period in seconds for each retry that will be made to restart the container on exit if the policy is set to on-failure (default -9223372036854775808) | ||
|
||
Global Flags: | ||
--debug Switch commands log level to DEBUG mode | ||
--host string Specify the address path to the Eclipse Kanto container management (default "/run/container-management/container-management.sock") | ||
--timeout int Specify the connection timeout in seconds to the Eclipse Kanto container management (default 30) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: update_help | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "-h"] | ||
expected: | ||
exitCode: 0 | ||
goldenFile: "update-help.golden" | ||
--- | ||
name: update_no_args | ||
command: | ||
binary: kanto-cm | ||
args: ["update"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: You must provide either an ID or a name for the container via --name (-n)" | ||
--- | ||
name: update_invalid_id | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "invalid"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: The requested container with ID = invalid was not found." | ||
--- | ||
name: update_invalid_name | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "-n", "invalid"] | ||
expected: | ||
exitCode: 1 | ||
err: "Error: The requested container with name = invalid was not found. Try using an ID instead." | ||
--- | ||
name: update_container_with_state_running | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
- binary: kanto-cm | ||
args: ["start", "-n", "test-it"] | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "-n", "test-it", "--rp", "no"] | ||
expected: | ||
exitCode: 0 | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] | ||
--- | ||
name: update_container_with_state_created | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "-n", "test-it", "--rp", "no"] | ||
expected: | ||
exitCode: 0 | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] | ||
--- | ||
name: update_container_with_state_stopped | ||
setupCmd: | ||
- binary: kanto-cm | ||
args: ["create", "--host", "$KANTO_HOST", "-n", "test-it", "docker.io/library/influxdb:1.8.4"] | ||
- binary: kanto-cm | ||
args: [ "start", "-n", "test-it" ] | ||
- binary: kanto-cm | ||
args: [ "stop", "-n", "test-it" ] | ||
command: | ||
binary: kanto-cm | ||
args: ["update", "-n", "test-it", "--rp", "no"] | ||
expected: | ||
exitCode: 0 | ||
onExit: | ||
- binary: "kanto-cm" | ||
args: ["remove","--host", "$KANTO_HOST", "-n", "test-it", "-f"] |