(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestProjectHash(t *testing.T) { |
| 27 | projA := &types.Project{ |
| 28 | Name: "fake-proj", |
| 29 | WorkingDir: "/tmp", |
| 30 | Services: map[string]types.ServiceConfig{ |
| 31 | "foo": {Image: "fake-image"}, |
| 32 | }, |
| 33 | DisabledServices: map[string]types.ServiceConfig{ |
| 34 | "bar": {Image: "diff-image"}, |
| 35 | }, |
| 36 | } |
| 37 | projB := &types.Project{ |
| 38 | Name: "fake-proj", |
| 39 | WorkingDir: "/tmp", |
| 40 | Services: map[string]types.ServiceConfig{ |
| 41 | "foo": {Image: "fake-image"}, |
| 42 | "bar": {Image: "diff-image"}, |
| 43 | }, |
| 44 | } |
| 45 | projC := &types.Project{ |
| 46 | Name: "fake-proj", |
| 47 | WorkingDir: "/tmp", |
| 48 | Services: map[string]types.ServiceConfig{ |
| 49 | "foo": {Image: "fake-image"}, |
| 50 | "bar": {Image: "diff-image"}, |
| 51 | "baz": {Image: "yet-another-image"}, |
| 52 | }, |
| 53 | } |
| 54 | |
| 55 | hashA, ok := projectHash(projA) |
| 56 | assert.Assert(t, ok) |
| 57 | assert.Assert(t, hashA != "") |
| 58 | hashB, ok := projectHash(projB) |
| 59 | assert.Assert(t, ok) |
| 60 | assert.Assert(t, hashB != "") |
| 61 | assert.Equal(t, hashA, hashB) |
| 62 | |
| 63 | hashC, ok := projectHash(projC) |
| 64 | assert.Assert(t, ok) |
| 65 | assert.Assert(t, hashC != "") |
| 66 | assert.Assert(t, hashC != hashA) |
| 67 | } |
nothing calls this directly
no test coverage detected