test add tests to spec_opts

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

test func WithDefaultPathEnv & WithDefaultSpecForPlatform

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

fix nil context

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

[test] TTY information && ProcessCwd

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

fix TestWithTTYSize value

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

test WithUserNamespace sets the uid and gid mappings for the task

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

format test file

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

update TestWithUserNamespace check condition

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

relaunch ci

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>

improve spec_opts_test test coverage

Signed-off-by: fahedouch <fahed.dorgaa@gmail.com>
This commit is contained in:
fahedouch
2019-11-15 21:39:58 +01:00
parent d1bcb4beea
commit afd33bce81
2 changed files with 131 additions and 1 deletions

View File

@@ -223,6 +223,32 @@ func TestWithCapabilitiesNil(t *testing.T) {
}
}
func TestPopulateDefaultWindowsSpec(t *testing.T) {
var (
c = containers.Container{ID: "TestWithDefaultSpec"}
ctx = namespaces.WithNamespace(context.Background(), "test")
)
var expected Spec
populateDefaultWindowsSpec(ctx, &expected, c.ID)
if expected.Windows == nil {
t.Error("Cannot populate windows Spec")
}
}
func TestPopulateDefaultUnixSpec(t *testing.T) {
var (
c = containers.Container{ID: "TestWithDefaultSpec"}
ctx = namespaces.WithNamespace(context.Background(), "test")
)
var expected Spec
populateDefaultUnixSpec(ctx, &expected, c.ID)
if expected.Linux == nil {
t.Error("Cannot populate Unix Spec")
}
}
func TestWithPrivileged(t *testing.T) {
t.Parallel()