From 157afdcdbea7712666e0fc9f860426f857bb4176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Mon, 7 Feb 2022 18:30:42 +0100 Subject: [PATCH] A few more container's tests --- containers/types.go | 2 +- glue/main_test.go | 107 +++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/containers/types.go b/containers/types.go index c546fc8..25fc484 100644 --- a/containers/types.go +++ b/containers/types.go @@ -93,7 +93,7 @@ func (c *Container) GetState() (*apps.AppState, error) { } // Status returns state of the container -// Possible values: running, stopped, no-container, unknown +// Possible values: running, exited (stopped), no-container, unknown func (c *Container) Status() (string, error) { status := "unknown" diff --git a/glue/main_test.go b/glue/main_test.go index 1b62344..27841d2 100644 --- a/glue/main_test.go +++ b/glue/main_test.go @@ -1,7 +1,6 @@ package glue import ( - "fmt" "log" "os" "path" @@ -67,11 +66,6 @@ func TestMain(m *testing.M) { exitVal := m.Run() - // We don't care about output here because we can't do anything about it - //! If testing fails and this won't be performed you have to remove the test container manually - fmt.Println("Removing test container") - processor.Delete() - os.Exit(exitVal) } @@ -82,9 +76,9 @@ func TestProcessorCreate(t *testing.T) { assert.Nil(t, err) } -func TestProcessorList(t *testing.T) { +// func TestProcessorList(t *testing.T) { -} +// } func TestProcessorGet(t *testing.T) { err := processor.Create(testAppTemplate) @@ -92,19 +86,19 @@ func TestProcessorGet(t *testing.T) { app, err := processor.Get() assert.Nil(t, err) - fmt.Println("State", app.State) + assert.Equal(t, "running", app.State) processor.Delete() assert.Nil(t, err) } -func TestProcessorRegister(t *testing.T) { +// func TestProcessorRegister(t *testing.T) { -} +// } -func TestProcessorUpdate(t *testing.T) { +// func TestProcessorUpdate(t *testing.T) { -} +// } func TestProcessorDelete(t *testing.T) { err := processor.Create(testAppTemplate) @@ -114,81 +108,92 @@ func TestProcessorDelete(t *testing.T) { } func TestProcessorStop(t *testing.T) { + err := processor.Create(testAppTemplate) + assert.Nil(t, err) + err = processor.Stop() + assert.Nil(t, err) + + app, err := processor.Get() + assert.Nil(t, err) + assert.Equal(t, "exited", app.State) + + processor.Delete() + assert.Nil(t, err) } -func TestProcessorStart(t *testing.T) { +// func TestProcessorStart(t *testing.T) { -} +// } -func TestProcessorRestart(t *testing.T) { +// func TestProcessorRestart(t *testing.T) { -} +// } -func TestProcessorUpdateKeys(t *testing.T) { +// func TestProcessorUpdateKeys(t *testing.T) { -} +// } -func TestProcessorSetPassword(t *testing.T) { +// func TestProcessorSetPassword(t *testing.T) { -} +// } -func TestProcessorProcesses(t *testing.T) { +// func TestProcessorProcesses(t *testing.T) { -} +// } -func TestProcessorEnableTech(t *testing.T) { +// func TestProcessorEnableTech(t *testing.T) { -} +// } -func TestProcessorRebuild(t *testing.T) { +// func TestProcessorRebuild(t *testing.T) { -} +// } -func TestProcessorAddLabel(t *testing.T) { +// func TestProcessorAddLabel(t *testing.T) { -} +// } -func TestProcessorRemoveLabel(t *testing.T) { +// func TestProcessorRemoveLabel(t *testing.T) { -} +// } -func TestProcessorGetNode(t *testing.T) { +// func TestProcessorGetNode(t *testing.T) { -} +// } -func TestProcessorCreateSnapshot(t *testing.T) { +// func TestProcessorCreateSnapshot(t *testing.T) { -} +// } -func TestProcessorRestoreFromSnapshot(t *testing.T) { +// func TestProcessorRestoreFromSnapshot(t *testing.T) { -} +// } -func TestProcessorListSnapshots(t *testing.T) { +// func TestProcessorListSnapshots(t *testing.T) { -} +// } -func TestProcessorListAppsSnapshots(t *testing.T) { +// func TestProcessorListAppsSnapshots(t *testing.T) { -} +// } -func TestProcessorListSnapshotsByLabel(t *testing.T) { +// func TestProcessorListSnapshotsByLabel(t *testing.T) { -} +// } -func TestProcessorGetSnapshot(t *testing.T) { +// func TestProcessorGetSnapshot(t *testing.T) { -} +// } -func TestProcessorGetSnapshotDownloadLink(t *testing.T) { +// func TestProcessorGetSnapshotDownloadLink(t *testing.T) { -} +// } -func TestProcessorDeleteSnapshot(t *testing.T) { +// func TestProcessorDeleteSnapshot(t *testing.T) { -} +// } -func TestProcessorDeleteAppSnapshots(t *testing.T) { +// func TestProcessorDeleteAppSnapshots(t *testing.T) { -} +// }