@@ -26,19 +26,21 @@ func TestToSidekickConfig(t *testing.T) {
2626 for _ , test := range []struct {
2727 name string
2828 library * config.Library
29- serviceConfig string
29+ channel * config. Channel
3030 googleapisDir string
3131 discoveryDir string
3232 want * sidekickconfig.Config
3333 }{
3434 {
3535 name : "minimal config" ,
3636 library : & config.Library {
37- Channel : "google/cloud/storage/v1" ,
38- Name : "google-cloud-storage" ,
37+ Name : "google-cloud-storage" ,
38+ },
39+ channel : & config.Channel {
40+ Path : "google/cloud/storage/v1" ,
41+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
3942 },
4043 googleapisDir : "/tmp/googleapis" ,
41- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
4244 want : & sidekickconfig.Config {
4345 General : sidekickconfig.GeneralConfig {
4446 Language : "rust" ,
@@ -57,13 +59,15 @@ func TestToSidekickConfig(t *testing.T) {
5759 {
5860 name : "with version and release level" ,
5961 library : & config.Library {
60- Channel : "google/cloud/storage/v1" ,
6162 Name : "google-cloud-storage" ,
6263 Version : "0.1.0" ,
6364 ReleaseLevel : "preview" ,
6465 },
66+ channel : & config.Channel {
67+ Path : "google/cloud/storage/v1" ,
68+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
69+ },
6570 googleapisDir : "/tmp/googleapis" ,
66- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
6771 want : & sidekickconfig.Config {
6872 General : sidekickconfig.GeneralConfig {
6973 Language : "rust" ,
@@ -84,12 +88,14 @@ func TestToSidekickConfig(t *testing.T) {
8488 {
8589 name : "with copyright year" ,
8690 library : & config.Library {
87- Channel : "google/cloud/storage/v1" ,
8891 Name : "google-cloud-storage" ,
8992 CopyrightYear : "2024" ,
9093 },
94+ channel : & config.Channel {
95+ Path : "google/cloud/storage/v1" ,
96+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
97+ },
9198 googleapisDir : "/tmp/googleapis" ,
92- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
9399 want : & sidekickconfig.Config {
94100 General : sidekickconfig.GeneralConfig {
95101 Language : "rust" ,
@@ -109,8 +115,7 @@ func TestToSidekickConfig(t *testing.T) {
109115 {
110116 name : "with rust config" ,
111117 library : & config.Library {
112- Channel : "google/cloud/storage/v1" ,
113- Name : "google-cloud-storage" ,
118+ Name : "google-cloud-storage" ,
114119 Rust : & config.RustCrate {
115120 ModulePath : "gcs" ,
116121 PerServiceFeatures : true ,
@@ -126,8 +131,11 @@ func TestToSidekickConfig(t *testing.T) {
126131 TemplateOverride : "custom-template" ,
127132 },
128133 },
134+ channel : & config.Channel {
135+ Path : "google/cloud/storage/v1" ,
136+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
137+ },
129138 googleapisDir : "/tmp/googleapis" ,
130- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
131139 want : & sidekickconfig.Config {
132140 General : sidekickconfig.GeneralConfig {
133141 Language : "rust" ,
@@ -158,15 +166,17 @@ func TestToSidekickConfig(t *testing.T) {
158166 {
159167 name : "with publish disabled" ,
160168 library : & config.Library {
161- Channel : "google/cloud/storage/v1" ,
162- Name : "google-cloud-storage" ,
169+ Name : "google-cloud-storage" ,
163170 Publish : & config.LibraryPublish {
164171 Disabled : true ,
165172 },
166173 Rust : & config.RustCrate {},
167174 },
175+ channel : & config.Channel {
176+ Path : "google/cloud/storage/v1" ,
177+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
178+ },
168179 googleapisDir : "/tmp/googleapis" ,
169- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
170180 want : & sidekickconfig.Config {
171181 General : sidekickconfig.GeneralConfig {
172182 Language : "rust" ,
@@ -186,8 +196,7 @@ func TestToSidekickConfig(t *testing.T) {
186196 {
187197 name : "with package dependencies" ,
188198 library : & config.Library {
189- Channel : "google/cloud/storage/v1" ,
190- Name : "google-cloud-storage" ,
199+ Name : "google-cloud-storage" ,
191200 Rust : & config.RustCrate {
192201 PackageDependencies : []config.RustPackageDependency {
193202 {
@@ -201,8 +210,11 @@ func TestToSidekickConfig(t *testing.T) {
201210 },
202211 },
203212 },
213+ channel : & config.Channel {
214+ Path : "google/cloud/storage/v1" ,
215+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
216+ },
204217 googleapisDir : "/tmp/googleapis" ,
205- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
206218 want : & sidekickconfig.Config {
207219 General : sidekickconfig.GeneralConfig {
208220 Language : "rust" ,
@@ -222,8 +234,7 @@ func TestToSidekickConfig(t *testing.T) {
222234 {
223235 name : "with documentation overrides" ,
224236 library : & config.Library {
225- Channel : "google/cloud/storage/v1" ,
226- Name : "google-cloud-storage" ,
237+ Name : "google-cloud-storage" ,
227238 Rust : & config.RustCrate {
228239 DocumentationOverrides : []config.RustDocumentationOverride {
229240 {
@@ -234,8 +245,11 @@ func TestToSidekickConfig(t *testing.T) {
234245 },
235246 },
236247 },
248+ channel : & config.Channel {
249+ Path : "google/cloud/storage/v1" ,
250+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
251+ },
237252 googleapisDir : "/tmp/googleapis" ,
238- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
239253 want : & sidekickconfig.Config {
240254 General : sidekickconfig.GeneralConfig {
241255 Language : "rust" ,
@@ -261,8 +275,7 @@ func TestToSidekickConfig(t *testing.T) {
261275 {
262276 name : "with pagination overrides" ,
263277 library : & config.Library {
264- Channel : "google/cloud/storage/v1" ,
265- Name : "google-cloud-storage" ,
278+ Name : "google-cloud-storage" ,
266279 Rust : & config.RustCrate {
267280 PaginationOverrides : []config.RustPaginationOverride {
268281 {
@@ -272,8 +285,11 @@ func TestToSidekickConfig(t *testing.T) {
272285 },
273286 },
274287 },
288+ channel : & config.Channel {
289+ Path : "google/cloud/storage/v1" ,
290+ ServiceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
291+ },
275292 googleapisDir : "/tmp/googleapis" ,
276- serviceConfig : "google/cloud/storage/v1/storage_v1.yaml" ,
277293 want : & sidekickconfig.Config {
278294 General : sidekickconfig.GeneralConfig {
279295 Language : "rust" ,
@@ -298,13 +314,15 @@ func TestToSidekickConfig(t *testing.T) {
298314 {
299315 name : "with discovery format" ,
300316 library : & config.Library {
301- Channel : "discoveries/compute.v1.json" ,
302317 Name : "google-cloud-compute-v1" ,
303318 SpecificationFormat : "discovery" ,
304319 },
320+ channel : & config.Channel {
321+ Path : "discoveries/compute.v1.json" ,
322+ ServiceConfig : "google/cloud/compute/v1/compute_v1.yaml" ,
323+ },
305324 googleapisDir : "/tmp/googleapis" ,
306325 discoveryDir : "/tmp/discovery-artifact-manager" ,
307- serviceConfig : "google/cloud/compute/v1/compute_v1.yaml" ,
308326 want : & sidekickconfig.Config {
309327 General : sidekickconfig.GeneralConfig {
310328 Language : "rust" ,
@@ -324,7 +342,7 @@ func TestToSidekickConfig(t *testing.T) {
324342 },
325343 } {
326344 t .Run (test .name , func (t * testing.T ) {
327- got := toSidekickConfig (test .library , test .serviceConfig , test .googleapisDir , test .discoveryDir )
345+ got := toSidekickConfig (test .library , test .channel , test .googleapisDir , test .discoveryDir )
328346 if diff := cmp .Diff (test .want , got ); diff != "" {
329347 t .Errorf ("mismatch (-want +got):\n %s" , diff )
330348 }
0 commit comments