mirror of https://github.com/containers/podman.git
Convert remaining state tests to new style
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #229 Approved by: rhatdan
This commit is contained in:
parent
aa34b86ae6
commit
54e258bfde
|
@ -513,21 +513,19 @@ func getAllContainersTwoContainers(t *testing.T, state State, lockPath string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerInUseInvalidContainer(t *testing.T) {
|
func TestContainerInUseInvalidContainer(t *testing.T) {
|
||||||
state, path, _, err := getEmptyState()
|
runForAllStates(t, "TestContainerInUseInvalidContainer", containerInUseInvalidContainer)
|
||||||
assert.NoError(t, err)
|
}
|
||||||
defer os.RemoveAll(path)
|
|
||||||
defer state.Close()
|
|
||||||
|
|
||||||
_, err = state.ContainerInUse(&Container{})
|
func containerInUseInvalidContainer(t *testing.T, state State, lockPath string) {
|
||||||
|
_, err := state.ContainerInUse(&Container{})
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerInUseOneContainer(t *testing.T) {
|
func TestContainerInUseOneContainer(t *testing.T) {
|
||||||
state, path, lockPath, err := getEmptyState()
|
runForAllStates(t, "TestContainerInUseOneContainer", containerInUseOneContainer)
|
||||||
assert.NoError(t, err)
|
}
|
||||||
defer os.RemoveAll(path)
|
|
||||||
defer state.Close()
|
|
||||||
|
|
||||||
|
func containerInUseOneContainer(t *testing.T, state State, lockPath string) {
|
||||||
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
||||||
|
@ -548,11 +546,10 @@ func TestContainerInUseOneContainer(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerInUseTwoContainers(t *testing.T) {
|
func TestContainerInUseTwoContainers(t *testing.T) {
|
||||||
state, path, lockPath, err := getEmptyState()
|
runForAllStates(t, "TestContainerInUseTwoContainers", containerInUseTwoContainers)
|
||||||
assert.NoError(t, err)
|
}
|
||||||
defer os.RemoveAll(path)
|
|
||||||
defer state.Close()
|
|
||||||
|
|
||||||
|
func containerInUseTwoContainers(t *testing.T, state State, lockPath string) {
|
||||||
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
||||||
|
@ -578,11 +575,10 @@ func TestContainerInUseTwoContainers(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCannotRemoveContainerWithDependency(t *testing.T) {
|
func TestCannotRemoveContainerWithDependency(t *testing.T) {
|
||||||
state, path, lockPath, err := getEmptyState()
|
runForAllStates(t, "TestCannotRemoveContainerWithDependency", cannotRemoveContainerWithDependency)
|
||||||
assert.NoError(t, err)
|
}
|
||||||
defer os.RemoveAll(path)
|
|
||||||
defer state.Close()
|
|
||||||
|
|
||||||
|
func cannotRemoveContainerWithDependency(t *testing.T, state State, lockPath string) {
|
||||||
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
||||||
|
@ -601,11 +597,10 @@ func TestCannotRemoveContainerWithDependency(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCanRemoveContainerAfterDependencyRemoved(t *testing.T) {
|
func TestCanRemoveContainerAfterDependencyRemoved(t *testing.T) {
|
||||||
state, path, lockPath, err := getEmptyState()
|
runForAllStates(t, "TestCanRemoveContainerAfterDependencyRemoved", canRemoveContainerAfterDependencyRemoved)
|
||||||
assert.NoError(t, err)
|
}
|
||||||
defer os.RemoveAll(path)
|
|
||||||
defer state.Close()
|
|
||||||
|
|
||||||
|
func canRemoveContainerAfterDependencyRemoved(t *testing.T, state State, lockPath string) {
|
||||||
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
testCtr1, err := getTestContainer("11111111111111111111111111111111", "test1", lockPath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
testCtr2, err := getTestContainer("22222222222222222222222222222222", "test2", lockPath)
|
||||||
|
|
Loading…
Reference in New Issue