-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_test.go
55 lines (45 loc) · 985 Bytes
/
docker_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package neco
import (
"context"
"os"
"path/filepath"
"testing"
)
func TestDockerRuntime(t *testing.T) {
t.Skip("manually tested")
rt, err := newDockerRuntime("")
if err != nil {
t.Fatal(err)
}
ctx := context.Background()
img, err := CurrentArtifacts.FindContainerImage("sabakan")
if err != nil {
t.Fatal(err)
}
if err := rt.Pull(ctx, img); err != nil {
t.Fatal(err)
}
dir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
if err := os.MkdirAll(filepath.Join(dir, "usr/local/bin"), 0755); err != nil {
t.Fatal(err)
}
if err := rt.Run(ctx, img, []Bind{
{Name: "root", Source: dir, Dest: "/host", ReadOnly: false},
}, []string{"/usr/local/sabakan/install-tools"}); err != nil {
t.Error(err)
}
if err := rt.Exec(ctx, "ubuntu", false, []string{"touch", "/foo"}); err != nil {
t.Error(err)
}
running, err := rt.IsRunning(img)
if err != nil {
t.Fatal(err)
}
if running {
t.Error(`not running`)
}
}