(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestHandler(t *testing.T) { |
| 31 | as := assert.New(t) |
| 32 | type testCase struct { |
| 33 | client CrioClient |
| 34 | name string |
| 35 | machineInfoFactory info.MachineInfoFactory |
| 36 | fsInfo fs.FsInfo |
| 37 | storageDriver storageDriver |
| 38 | storageDir string |
| 39 | cgroupSubsystems map[string]string |
| 40 | inHostNamespace bool |
| 41 | metadataEnvAllowList []string |
| 42 | includedMetrics container.MetricSet |
| 43 | |
| 44 | hasErr bool |
| 45 | errContains string |
| 46 | checkReference *info.ContainerReference |
| 47 | } |
| 48 | for _, ts := range []testCase{ |
| 49 | { |
| 50 | mockCrioClient(Info{}, nil, fmt.Errorf("no client returned")), |
| 51 | "/kubepods/pod068e8fa0-9213-11e7-a01f-507b9d4141fa/crio-81e5c2990803c383229c9680ce964738d5e566d97f5bd436ac34808d2ec75d5f", |
| 52 | nil, |
| 53 | nil, |
| 54 | "", |
| 55 | "", |
| 56 | nil, |
| 57 | false, |
| 58 | nil, |
| 59 | nil, |
| 60 | |
| 61 | true, |
| 62 | "no client returned", |
| 63 | nil, |
| 64 | }, |
| 65 | { |
| 66 | mockCrioClient(Info{}, nil, nil), |
| 67 | "/kubepods/pod068e8fa0-9213-11e7-a01f-507b9d4141fa/crio-81e5c2990803c383229c9680ce964738d5e566d97f5bd436ac34808d2ec75d5f", |
| 68 | nil, |
| 69 | nil, |
| 70 | "", |
| 71 | "", |
| 72 | nil, |
| 73 | false, |
| 74 | nil, |
| 75 | nil, |
| 76 | |
| 77 | true, |
| 78 | "no container with id 81e5c2990803c383229c9680ce964738d5e566d97f5bd436ac34808d2ec75d5f", |
| 79 | nil, |
| 80 | }, |
| 81 | { |
| 82 | mockCrioClient( |
| 83 | Info{}, |
| 84 | map[string]*ContainerInfo{"81e5c2990803c383229c9680ce964738d5e566d97f5bd436ac34808d2ec75d5f": {Name: "test", Labels: map[string]string{"io.kubernetes.container.name": "POD"}}}, |
| 85 | nil, |
| 86 | ), |
| 87 | "/kubepods/pod068e8fa0-9213-11e7-a01f-507b9d4141fa/crio-81e5c2990803c383229c9680ce964738d5e566d97f5bd436ac34808d2ec75d5f", |
nothing calls this directly
no test coverage detected
searching dependent graphs…