(t *testing.T)
| 115 | } |
| 116 | |
| 117 | func TestBuildGraph(t *testing.T) { |
| 118 | testCases := []struct { |
| 119 | desc string |
| 120 | services types.Services |
| 121 | expectedVertices map[string]*Vertex |
| 122 | }{ |
| 123 | { |
| 124 | desc: "builds graph with single service", |
| 125 | services: types.Services{ |
| 126 | "test": { |
| 127 | Name: "test", |
| 128 | DependsOn: types.DependsOnConfig{}, |
| 129 | }, |
| 130 | }, |
| 131 | expectedVertices: map[string]*Vertex{ |
| 132 | "test": { |
| 133 | Key: "test", |
| 134 | Service: "test", |
| 135 | Status: ServiceStopped, |
| 136 | Children: map[string]*Vertex{}, |
| 137 | Parents: map[string]*Vertex{}, |
| 138 | }, |
| 139 | }, |
| 140 | }, |
| 141 | { |
| 142 | desc: "builds graph with two separate services", |
| 143 | services: types.Services{ |
| 144 | "test": { |
| 145 | Name: "test", |
| 146 | DependsOn: types.DependsOnConfig{}, |
| 147 | }, |
| 148 | "another": { |
| 149 | Name: "another", |
| 150 | DependsOn: types.DependsOnConfig{}, |
| 151 | }, |
| 152 | }, |
| 153 | expectedVertices: map[string]*Vertex{ |
| 154 | "test": { |
| 155 | Key: "test", |
| 156 | Service: "test", |
| 157 | Status: ServiceStopped, |
| 158 | Children: map[string]*Vertex{}, |
| 159 | Parents: map[string]*Vertex{}, |
| 160 | }, |
| 161 | "another": { |
| 162 | Key: "another", |
| 163 | Service: "another", |
| 164 | Status: ServiceStopped, |
| 165 | Children: map[string]*Vertex{}, |
| 166 | Parents: map[string]*Vertex{}, |
| 167 | }, |
| 168 | }, |
| 169 | }, |
| 170 | { |
| 171 | desc: "builds graph with a service and a dependency", |
| 172 | services: types.Services{ |
| 173 | "test": { |
| 174 | Name: "test", |
nothing calls this directly
no test coverage detected