From 156d6f11a6c0b6ef18e304b890f9c7ed31e4a437 Mon Sep 17 00:00:00 2001 From: Daniel Milchev Date: Tue, 7 Feb 2023 11:15:23 +0200 Subject: [PATCH] [#118] Provide integration test for the CLI get command Created golden file and test case scenarios with exit code 1. Signed-off-by: Daniel Milchev --- integration/testdata/get-help.golden | 18 ++++++++++++++++++ integration/testdata/get-test.yaml | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 integration/testdata/get-help.golden create mode 100644 integration/testdata/get-test.yaml diff --git a/integration/testdata/get-help.golden b/integration/testdata/get-help.golden new file mode 100644 index 0000000..0b0189e --- /dev/null +++ b/integration/testdata/get-help.golden @@ -0,0 +1,18 @@ +Get detailed information about a given container. + +Usage: + kanto-cm get + +Examples: +get + get --name + get -n + +Flags: + -h, --help help for get + -n, --name string Get the information about a container with a specific name. + +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) diff --git a/integration/testdata/get-test.yaml b/integration/testdata/get-test.yaml new file mode 100644 index 0000000..0bb4241 --- /dev/null +++ b/integration/testdata/get-test.yaml @@ -0,0 +1,23 @@ +name: get_help +command: + binary: kanto-cm + args: ["get", "-h"] +expected: + exitCode: 0 +goldenFile: "get-help.golden" +--- +name: get_invalid_id +command: + binary: kanto-cm + args: ["get", "invalid"] +expected: + exitCode: 1 + err: "Error: The requested container with ID = invalid was not found" +--- +name: get_invalid_name +command: + binary: kanto-cm + args: ["get", "-n", "invalid"] +expected: + exitCode: 1 + err: "Error: The requested container with name = invalid was not found. Try using an ID instead." \ No newline at end of file