MCPcopy
hub / github.com/google/cadvisor / New

Function New

integration/framework/framework.go:76–110  ·  view source on GitHub ↗

Instantiates a Framework. Cleanup *must* be called. Class is thread-compatible. All framework actions report fatal errors on the t specified at creation time. Typical use: func TestFoo(t *testing.T) { fm := framework.New(t) defer fm.Cleanup() ... actual test ... }

(t *testing.T)

Source from the content-addressed store, hash-verified

74// ... actual test ...
75// }
76func New(t *testing.T) Framework {
77 // All integration tests are large.
78 if testing.Short() {
79 t.Skip("Skipping framework test in short mode")
80 }
81
82 // Try to see if non-localhost hosts are GCE instances.
83 fm := &realFramework{
84 hostname: HostnameInfo{
85 Host: *host,
86 Port: *port,
87 },
88 t: t,
89 cleanups: make([]func(), 0),
90 }
91 fm.shellActions = shellActions{
92 fm: fm,
93 }
94 fm.dockerActions = dockerActions{
95 fm: fm,
96 }
97 fm.crioActions = crioActions{
98 fm: fm,
99 podSeqNum: 0,
100 }
101 fm.containerdActions = containerdActions{
102 fm: fm,
103 seqNum: 0,
104 namespace: "k8s.io",
105 socket: getContainerdSocket(),
106 snapshotter: "native",
107 }
108
109 return fm
110}
111
112// getContainerdSocket returns the containerd socket path from CONTAINERD_SOCK env var.
113func getContainerdSocket() string {

Calls 1

getContainerdSocketFunction · 0.85