mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-02 05:34:46 +00:00
virtcontainers: Add additional unit tests for sandbox
Add tests for state change, empty string failures for Volumes and Sockets. Change two function names to accurately reflect tests. Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
This commit is contained in:
parent
07a307b4b1
commit
0b3cbee815
@ -44,12 +44,17 @@ func TestSandboxStateRunningStopped(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestSandboxStateReadyPaused(t *testing.T) {
|
||||
func TestSandboxStateReadyStopped(t *testing.T) {
|
||||
err := testSandboxStateTransition(t, StateReady, StateStopped)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestSandboxStatePausedReady(t *testing.T) {
|
||||
func TestSandboxStateStoppedRunning(t *testing.T) {
|
||||
err := testSandboxStateTransition(t, StateStopped, StateRunning)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestSandboxStateStoppedReady(t *testing.T) {
|
||||
err := testSandboxStateTransition(t, StateStopped, StateReady)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
@ -104,6 +109,15 @@ func TestVolumesSetSuccessful(t *testing.T) {
|
||||
assert.Exactly(t, *volumes, expected)
|
||||
}
|
||||
|
||||
func TestVolumesSetFailingEmptyString(t *testing.T) {
|
||||
volumes := &Volumes{}
|
||||
|
||||
volStr := ""
|
||||
|
||||
err := volumes.Set(volStr)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestVolumesSetFailingTooFewArguments(t *testing.T) {
|
||||
volumes := &Volumes{}
|
||||
|
||||
@ -174,6 +188,15 @@ func TestSocketsSetSuccessful(t *testing.T) {
|
||||
assert.Exactly(t, *sockets, expected)
|
||||
}
|
||||
|
||||
func TestSocketsSetFailingEmptyString(t *testing.T) {
|
||||
sockets := &Sockets{}
|
||||
|
||||
sockStr := ""
|
||||
|
||||
err := sockets.Set(sockStr)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
func TestSocketsSetFailingWrongArgsAmount(t *testing.T) {
|
||||
sockets := &Sockets{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user