@@ -4,53 +4,14 @@ import (
44 "testing"
55
66 "github.com/stretchr/testify/assert"
7- "github.com/stretchr/testify/require"
87)
98
109func TestMustLoadConfig (t * testing.T ) {
1110 cfg := MustLoadConfig ()
12- require .NotNil (t , cfg )
13- require .NotNil (t , cfg .Resources )
14-
15- // Verify some known resource configurations
16- volumes := cfg .Resources ["volumes" ]
17- assert .Len (t , volumes .RecreateOnChanges , 4 )
18- assert .Len (t , volumes .UpdateIDOnChanges , 1 )
19- assert .Equal (t , "name" , volumes .UpdateIDOnChanges [0 ].String ())
20-
21- schemas := cfg .Resources ["schemas" ]
22- assert .Len (t , schemas .RecreateOnChanges , 3 )
23-
24- // Verify nested paths work
25- endpoints := cfg .Resources ["model_serving_endpoints" ]
26- found := false
27- for _ , p := range endpoints .RecreateOnChanges {
28- if p .String () == "config.auto_capture_config.catalog_name" {
29- found = true
30- break
31- }
32- }
33- assert .True (t , found , "should find nested path config.auto_capture_config.catalog_name" )
11+ assert .NotEmpty (t , cfg .Resources )
3412}
3513
3614func TestGetResourceConfig (t * testing.T ) {
37- // Existing resource
38- cfg := GetResourceConfig ("volumes" )
39- require .NotNil (t , cfg )
40- assert .Len (t , cfg .RecreateOnChanges , 4 )
41-
42- // Non-existing resource returns nil
43- cfg = GetResourceConfig ("nonexistent" )
44- assert .Nil (t , cfg )
45-
46- // Jobs have no config in resources.yml
47- cfg = GetResourceConfig ("jobs" )
48- assert .Nil (t , cfg )
49- }
50-
51- func TestConfigIgnoreRemoteChanges (t * testing.T ) {
52- cfg := GetResourceConfig ("experiments" )
53- require .NotNil (t , cfg )
54- require .Len (t , cfg .IgnoreRemoteChanges , 1 )
55- assert .Equal (t , "tags" , cfg .IgnoreRemoteChanges [0 ].String ())
15+ assert .NotNil (t , GetResourceConfig ("volumes" ))
16+ assert .Nil (t , GetResourceConfig ("nonexistent" ))
5617}
0 commit comments