@@ -21,7 +21,7 @@ import (
21
21
"fmt"
22
22
"testing"
23
23
24
- "github.com/GoogleContainerTools/skaffold/pkg/skaffold/build "
24
+ "github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph "
25
25
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
26
26
"github.com/GoogleContainerTools/skaffold/testutil"
27
27
)
@@ -30,9 +30,9 @@ func TestGetArtifacts(t *testing.T) {
30
30
tests := []struct {
31
31
description string
32
32
artifacts []* latest.Artifact
33
- fromFile []build .Artifact
34
- fromCLI []build .Artifact
35
- expected []build .Artifact
33
+ fromFile []graph .Artifact
34
+ fromCLI []graph .Artifact
35
+ expected []graph .Artifact
36
36
customTag string
37
37
shouldErr bool
38
38
}{
@@ -41,41 +41,41 @@ func TestGetArtifacts(t *testing.T) {
41
41
artifacts : nil ,
42
42
fromFile : nil ,
43
43
fromCLI : nil ,
44
- expected : []build .Artifact (nil ),
44
+ expected : []graph .Artifact (nil ),
45
45
},
46
46
{
47
47
description : "from file" ,
48
48
artifacts : []* latest.Artifact {{ImageName : "image" }},
49
- fromFile : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
49
+ fromFile : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
50
50
fromCLI : nil ,
51
- expected : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
51
+ expected : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
52
52
},
53
53
{
54
54
description : "from CLI" ,
55
55
artifacts : []* latest.Artifact {{ImageName : "image" }},
56
56
fromFile : nil ,
57
- fromCLI : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
58
- expected : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
57
+ fromCLI : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
58
+ expected : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
59
59
},
60
60
{
61
61
description : "one from file, one from CLI" ,
62
62
artifacts : []* latest.Artifact {{ImageName : "image1" }, {ImageName : "image2" }},
63
- fromFile : []build .Artifact {{ImageName : "image1" , Tag : "image1:tag" }},
64
- fromCLI : []build .Artifact {{ImageName : "image2" , Tag : "image2:tag" }},
65
- expected : []build .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
63
+ fromFile : []graph .Artifact {{ImageName : "image1" , Tag : "image1:tag" }},
64
+ fromCLI : []graph .Artifact {{ImageName : "image2" , Tag : "image2:tag" }},
65
+ expected : []graph .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
66
66
},
67
67
{
68
68
description : "file takes precedence on CLI" ,
69
69
artifacts : []* latest.Artifact {{ImageName : "image1" }, {ImageName : "image2" }},
70
- fromFile : []build .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
71
- fromCLI : []build .Artifact {{ImageName : "image1" , Tag : "image1:ignored" }},
72
- expected : []build .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
70
+ fromFile : []graph .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
71
+ fromCLI : []graph .Artifact {{ImageName : "image1" , Tag : "image1:ignored" }},
72
+ expected : []graph .Artifact {{ImageName : "image1" , Tag : "image1:tag" }, {ImageName : "image2" , Tag : "image2:tag" }},
73
73
},
74
74
{
75
75
description : "provide tag for non-artifact" ,
76
76
artifacts : []* latest.Artifact {},
77
- fromCLI : []build .Artifact {{ImageName : "busybox" , Tag : "busybox:v1" }},
78
- expected : []build .Artifact {{ImageName : "busybox" , Tag : "busybox:v1" }},
77
+ fromCLI : []graph .Artifact {{ImageName : "busybox" , Tag : "busybox:v1" }},
78
+ expected : []graph .Artifact {{ImageName : "busybox" , Tag : "busybox:v1" }},
79
79
},
80
80
{
81
81
description : "missing tag" ,
@@ -87,25 +87,25 @@ func TestGetArtifacts(t *testing.T) {
87
87
{
88
88
description : "override tag" ,
89
89
artifacts : []* latest.Artifact {{ImageName : "image1" }, {ImageName : "image2" }},
90
- fromFile : []build .Artifact {{ImageName : "image1" , Tag : "image1:tag" }},
91
- fromCLI : []build .Artifact {{ImageName : "image2" , Tag : "image2:tag" }},
92
- expected : []build .Artifact {{ImageName : "image1" , Tag : "image1:test" }, {ImageName : "image2" , Tag : "image2:test" }},
90
+ fromFile : []graph .Artifact {{ImageName : "image1" , Tag : "image1:tag" }},
91
+ fromCLI : []graph .Artifact {{ImageName : "image2" , Tag : "image2:tag" }},
92
+ expected : []graph .Artifact {{ImageName : "image1" , Tag : "image1:test" }, {ImageName : "image2" , Tag : "image2:test" }},
93
93
customTag : "test" ,
94
94
},
95
95
{
96
96
description : "override missing tag" ,
97
97
artifacts : []* latest.Artifact {{ImageName : "image1" }, {ImageName : "image2" }},
98
98
fromFile : nil ,
99
99
fromCLI : nil ,
100
- expected : []build .Artifact {{ImageName : "image1" , Tag : "image1:test" }, {ImageName : "image2" , Tag : "image2:test" }},
100
+ expected : []graph .Artifact {{ImageName : "image1" , Tag : "image1:test" }, {ImageName : "image2" , Tag : "image2:test" }},
101
101
customTag : "test" ,
102
102
},
103
103
{
104
104
description : "apply tags to no artifacts" ,
105
105
artifacts : []* latest.Artifact {},
106
106
fromFile : nil ,
107
107
fromCLI : nil ,
108
- expected : []build .Artifact (nil ),
108
+ expected : []graph .Artifact (nil ),
109
109
customTag : "test" ,
110
110
},
111
111
}
@@ -125,57 +125,57 @@ func TestGetArtifacts(t *testing.T) {
125
125
func Test_getBuildArtifactsAndSetTags (t * testing.T ) {
126
126
tests := []struct {
127
127
description string
128
- artifacts []build .Artifact
129
- expected []build .Artifact
128
+ artifacts []graph .Artifact
129
+ expected []graph .Artifact
130
130
defaultRepo string
131
131
shouldErr bool
132
132
}{
133
133
{
134
134
description : "no artifact without default-repo" ,
135
135
artifacts : nil ,
136
- expected : []build .Artifact (nil ),
136
+ expected : []graph .Artifact (nil ),
137
137
},
138
138
{
139
139
description : "single artifact without default-repo" ,
140
- artifacts : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
141
- expected : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
140
+ artifacts : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
141
+ expected : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
142
142
},
143
143
{
144
144
description : "multiple artifacts without default-repo" ,
145
- artifacts : []build .Artifact {
145
+ artifacts : []graph .Artifact {
146
146
{ImageName : "image1" , Tag : "image1:tag" },
147
147
{ImageName : "image1" , Tag : "image1:tag" },
148
148
},
149
- expected : []build .Artifact {
149
+ expected : []graph .Artifact {
150
150
{ImageName : "image1" , Tag : "image1:tag" },
151
151
{ImageName : "image1" , Tag : "image1:tag" },
152
152
},
153
153
},
154
154
{
155
155
description : "single artifact with default-repo" ,
156
- artifacts : []build .Artifact {{ImageName : "image" , Tag : "image:tag" }},
157
- expected : []build .Artifact {{ImageName : "image" , Tag : "example.com/test-repo/image:tag" }},
156
+ artifacts : []graph .Artifact {{ImageName : "image" , Tag : "image:tag" }},
157
+ expected : []graph .Artifact {{ImageName : "image" , Tag : "example.com/test-repo/image:tag" }},
158
158
defaultRepo : "example.com/test-repo" ,
159
159
},
160
160
{
161
161
description : "multiple artifacts with default-repo" ,
162
- artifacts : []build .Artifact {
162
+ artifacts : []graph .Artifact {
163
163
{ImageName : "image1" , Tag : "image1:tag" },
164
164
{ImageName : "image1" , Tag : "image1:tag" },
165
165
},
166
- expected : []build .Artifact {
166
+ expected : []graph .Artifact {
167
167
{ImageName : "image1" , Tag : "example.com/test-repo/image1:tag" },
168
168
{ImageName : "image1" , Tag : "example.com/test-repo/image1:tag" },
169
169
},
170
170
defaultRepo : "example.com/test-repo" ,
171
171
},
172
172
{
173
173
description : "multiple artifacts with erring default-repo" ,
174
- artifacts : []build .Artifact {
174
+ artifacts : []graph .Artifact {
175
175
{ImageName : "image1" , Tag : "image1:tag" },
176
176
{ImageName : "image1" , Tag : "image1:tag" },
177
177
},
178
- expected : []build .Artifact (nil ),
178
+ expected : []graph .Artifact (nil ),
179
179
defaultRepo : "example.com/test-repo" ,
180
180
shouldErr : true ,
181
181
},
0 commit comments