@@ -10,18 +10,18 @@ import (
1010 "github.com/spf13/cobra"
1111 "github.com/stretchr/testify/require"
1212
13- "ocm.software/open-component-model/bindings/go/configuration/filesystem/v1alpha1"
14- "ocm.software/open-component-model/bindings/go/configuration/v1 "
13+ filesystemv1alpha1 "ocm.software/open-component-model/bindings/go/configuration/filesystem/v1alpha1/spec "
14+ genericv1 "ocm.software/open-component-model/bindings/go/configuration/generic/v1/spec "
1515 "ocm.software/open-component-model/bindings/go/runtime"
1616 ocmctx "ocm.software/open-component-model/cli/internal/context"
1717)
1818
1919func init () {
20- v1 .Scheme .MustRegisterWithAlias (& v1alpha1 .Config {}, runtime .NewVersionedType (v1alpha1 .ConfigType , v1alpha1 .Version ))
20+ genericv1 .Scheme .MustRegisterWithAlias (& filesystemv1alpha1 .Config {}, runtime .NewVersionedType (filesystemv1alpha1 .ConfigType , filesystemv1alpha1 .Version ))
2121}
2222
2323// createConfigWithFilesystemConfig creates a v1.Config with filesystem configuration from JSON
24- func createConfigWithFilesystemConfig (tempFolder string ) * v1 .Config {
24+ func createConfigWithFilesystemConfig (tempFolder string ) * genericv1 .Config {
2525 configJSON := `{
2626 "configurations": [
2727 {
@@ -31,7 +31,7 @@ func createConfigWithFilesystemConfig(tempFolder string) *v1.Config {
3131 ]
3232 }`
3333
34- config := & v1 .Config {}
34+ config := & genericv1 .Config {}
3535 if err := json .Unmarshal ([]byte (configJSON ), config ); err != nil {
3636 panic (err )
3737 }
@@ -42,7 +42,7 @@ func TestSetupFilesystemConfig(t *testing.T) {
4242 tests := []struct {
4343 name string
4444 cliFlag string
45- existingConfig * v1 .Config
45+ existingConfig * genericv1 .Config
4646 expectedTempFolder string
4747 expectedConfigMerge bool
4848 }{
@@ -56,7 +56,7 @@ func TestSetupFilesystemConfig(t *testing.T) {
5656 {
5757 name : "CLI flag with empty central config" ,
5858 cliFlag : "/tmp/custom" ,
59- existingConfig : & v1 .Config {},
59+ existingConfig : & genericv1 .Config {},
6060 expectedTempFolder : "/tmp/custom" ,
6161 expectedConfigMerge : false , // Config merge fails due to scheme registration issue
6262 },
@@ -77,7 +77,7 @@ func TestSetupFilesystemConfig(t *testing.T) {
7777 {
7878 name : "No CLI flag and no existing config" ,
7979 cliFlag : "" ,
80- existingConfig : & v1 .Config {},
80+ existingConfig : & genericv1 .Config {},
8181 expectedTempFolder : os .TempDir (), // filesystem config defaults to os.TempDir()
8282 expectedConfigMerge : false ,
8383 },
@@ -130,10 +130,10 @@ func TestSetupFilesystemConfig(t *testing.T) {
130130 // Verify the filesystem config was added correctly
131131 found := false
132132 for _ , cfg := range centralCfg .Configurations {
133- if cfg .Type .Name == v1alpha1 .ConfigType {
133+ if cfg .Type .Name == filesystemv1alpha1 .ConfigType {
134134 found = true
135- fsConfig := & v1alpha1 .Config {}
136- err := v1 .Scheme .Convert (cfg , fsConfig )
135+ fsConfig := & filesystemv1alpha1 .Config {}
136+ err := genericv1 .Scheme .Convert (cfg , fsConfig )
137137 r .NoError (err , "should convert to filesystem config" )
138138 r .Equal (tt .expectedTempFolder , fsConfig .TempFolder , "merged config should have correct temp folder" )
139139 break
@@ -148,7 +148,7 @@ func TestSetupFilesystemConfig(t *testing.T) {
148148func TestHasFilesystemConfig (t * testing.T ) {
149149 tests := []struct {
150150 name string
151- config * v1 .Config
151+ config * genericv1 .Config
152152 expected bool
153153 }{
154154 {
@@ -158,7 +158,7 @@ func TestHasFilesystemConfig(t *testing.T) {
158158 },
159159 {
160160 name : "empty config" ,
161- config : & v1 .Config {},
161+ config : & genericv1 .Config {},
162162 expected : false ,
163163 },
164164 {
@@ -168,15 +168,15 @@ func TestHasFilesystemConfig(t *testing.T) {
168168 },
169169 {
170170 name : "config with other types" ,
171- config : func () * v1 .Config {
171+ config : func () * genericv1 .Config {
172172 configJSON := `{
173173 "configurations": [
174174 {
175175 "type": "other.type/v1"
176176 }
177177 ]
178178 }`
179- config := & v1 .Config {}
179+ config := & genericv1 .Config {}
180180 if err := json .Unmarshal ([]byte (configJSON ), config ); err != nil {
181181 panic (err )
182182 }
@@ -186,7 +186,7 @@ func TestHasFilesystemConfig(t *testing.T) {
186186 },
187187 {
188188 name : "config with mixed types including filesystem" ,
189- config : func () * v1 .Config {
189+ config : func () * genericv1 .Config {
190190 configJSON := `{
191191 "configurations": [
192192 {
@@ -198,7 +198,7 @@ func TestHasFilesystemConfig(t *testing.T) {
198198 }
199199 ]
200200 }`
201- config := & v1 .Config {}
201+ config := & genericv1 .Config {}
202202 if err := json .Unmarshal ([]byte (configJSON ), config ); err != nil {
203203 panic (err )
204204 }
@@ -208,7 +208,7 @@ func TestHasFilesystemConfig(t *testing.T) {
208208 },
209209 {
210210 name : "config with unversioned filesystem config" ,
211- config : func () * v1 .Config {
211+ config : func () * genericv1 .Config {
212212 configJSON := `{
213213 "configurations": [
214214 {
@@ -217,7 +217,7 @@ func TestHasFilesystemConfig(t *testing.T) {
217217 }
218218 ]
219219 }`
220- config := & v1 .Config {}
220+ config := & genericv1 .Config {}
221221 if err := json .Unmarshal ([]byte (configJSON ), config ); err != nil {
222222 panic (err )
223223 }
@@ -238,37 +238,37 @@ func TestHasFilesystemConfig(t *testing.T) {
238238func TestAddFilesystemConfigToCentralConfig (t * testing.T ) {
239239 tests := []struct {
240240 name string
241- initialConfig * v1 .Config
242- fsCfg * v1alpha1 .Config
241+ initialConfig * genericv1 .Config
242+ fsCfg * filesystemv1alpha1 .Config
243243 expectedError bool
244244 expectedCount int
245245 }{
246246 {
247247 name : "add to empty config" ,
248- initialConfig : & v1 .Config {},
249- fsCfg : & v1alpha1 .Config {
248+ initialConfig : & genericv1 .Config {},
249+ fsCfg : & filesystemv1alpha1 .Config {
250250 TempFolder : "/tmp/test" ,
251251 },
252252 expectedError : false ,
253253 expectedCount : 1 ,
254254 },
255255 {
256256 name : "add to existing config" ,
257- initialConfig : func () * v1 .Config {
257+ initialConfig : func () * genericv1 .Config {
258258 configJSON := `{
259259 "configurations": [
260260 {
261261 "type": "other.type/v1"
262262 }
263263 ]
264264 }`
265- config := & v1 .Config {}
265+ config := & genericv1 .Config {}
266266 if err := json .Unmarshal ([]byte (configJSON ), config ); err != nil {
267267 panic (err )
268268 }
269269 return config
270270 }(),
271- fsCfg : & v1alpha1 .Config {
271+ fsCfg : & filesystemv1alpha1 .Config {
272272 TempFolder : "/tmp/test" ,
273273 },
274274 expectedError : false ,
@@ -277,7 +277,7 @@ func TestAddFilesystemConfigToCentralConfig(t *testing.T) {
277277 {
278278 name : "nil central config" ,
279279 initialConfig : nil ,
280- fsCfg : & v1alpha1 .Config {
280+ fsCfg : & filesystemv1alpha1 .Config {
281281 TempFolder : "/tmp/test" ,
282282 },
283283 expectedError : true ,
@@ -319,10 +319,10 @@ func TestAddFilesystemConfigToCentralConfig(t *testing.T) {
319319 // Verify the filesystem config was added correctly
320320 found := false
321321 for _ , cfg := range centralCfg .Configurations {
322- if cfg .Type .Name == v1alpha1 .ConfigType {
322+ if cfg .Type .Name == filesystemv1alpha1 .ConfigType {
323323 found = true
324- fsConfig := & v1alpha1 .Config {}
325- err := v1 .Scheme .Convert (cfg , fsConfig )
324+ fsConfig := & filesystemv1alpha1 .Config {}
325+ err := genericv1 .Scheme .Convert (cfg , fsConfig )
326326 r .NoError (err , "should convert to filesystem config" )
327327 r .Equal (tt .fsCfg .TempFolder , fsConfig .TempFolder , "should have correct temp folder" )
328328 break
0 commit comments