Skip to content

Commit 8897690

Browse files
authored
Merge pull request #111 from thin-edge/fix-container-remove
fix(internal): fix container-remove command and add test
2 parents 6a0adcd + 07e2017 commit 8897690

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

cli/tools/container_remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ContainerRemoveCommand struct {
2929

3030
// NewContainerLogsCommand creates a new container remove command
3131
func NewContainerRemoveCommand(ctx cli.Cli) *cobra.Command {
32-
command := &ContainerLogsCommand{
32+
command := &ContainerRemoveCommand{
3333
CommandContext: ctx,
3434
}
3535
cmd := &cobra.Command{

tests/container-remove.robot

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
*** Settings ***
2+
Resource ./resources/common.robot
3+
Library String
4+
Library Cumulocity
5+
Library DeviceLibrary bootstrap_script=bootstrap.sh
6+
7+
Suite Setup Suite Setup
8+
9+
Test Tags docker podman
10+
11+
*** Test Cases ***
12+
13+
Remove Container
14+
DeviceLibrary.Execute Command cmd=sudo tedge-container engine docker run -d --network bridge --name app30 httpd:2.4.61-alpine
15+
DeviceLibrary.Execute Command cmd=sudo tedge-container engine docker container inspect app30 exp_exit_code=0
16+
17+
DeviceLibrary.Execute Command cmd=sudo tedge-container tools container-remove app30
18+
DeviceLibrary.Execute Command cmd=sudo tedge-container engine docker container inspect app30 exp_exit_code=!0
19+
20+
Remove Container Non Existent Container Should Not Through An Error
21+
DeviceLibrary.Execute Command cmd=sudo tedge-container tools container-remove app31
22+
23+
*** Keywords ***
24+
25+
Suite Setup
26+
${DEVICE_SN}= Setup
27+
Set Suite Variable $DEVICE_SN
28+
Cumulocity.External Identity Should Exist ${DEVICE_SN}
29+
Cumulocity.Should Have Services name=tedge-container-plugin service_type=service min_count=1 max_count=1 timeout=30
30+
31+
${operation}= Cumulocity.Execute Shell Command sudo tedge-container engine docker network create tedge ||:
32+
Operation Should Be SUCCESSFUL ${operation} timeout=60
33+
34+
# Create data directory
35+
DeviceLibrary.Execute Command mkdir /data

0 commit comments

Comments
 (0)