@@ -40,7 +40,7 @@ func TestEntry(t *testing.T) {
40
40
t .Run ("zero" , func (t * testing.T ) {
41
41
t .Parallel ()
42
42
43
- mgr := runtimeconfig .NewNoopManager ()
43
+ rlv := runtimeconfig .NewNoopResolver ()
44
44
45
45
// A zero-value declaration of a runtimeconfig.Entry should behave as a zero value of the generic type.
46
46
// NB! A name has not been set for this entry; it is "uninitialized".
@@ -52,18 +52,19 @@ func TestEntry(t *testing.T) {
52
52
require .NoError (t , field .SetStartupValue ("true" ))
53
53
54
54
// But attempting to resolve will produce an error.
55
- _ , err := field .Resolve (context .Background (), mgr )
55
+ _ , err := field .Resolve (context .Background (), rlv )
56
56
require .ErrorIs (t , err , runtimeconfig .ErrNameNotSet )
57
57
// But attempting to set the runtime value will produce an error.
58
58
val := serpent .BoolOf (ptr .Ref (true ))
59
- require .ErrorIs (t , field .SetRuntimeValue (context .Background (), mgr , val ), runtimeconfig .ErrNameNotSet )
59
+ require .ErrorIs (t , field .SetRuntimeValue (context .Background (), rlv , val ), runtimeconfig .ErrNameNotSet )
60
60
})
61
61
62
62
t .Run ("simple" , func (t * testing.T ) {
63
63
t .Parallel ()
64
64
65
65
ctx := testutil .Context (t , testutil .WaitShort )
66
- mgr := runtimeconfig .NewStoreManager (dbmem .New ())
66
+ mgr := runtimeconfig .NewStoreManager ()
67
+ db := dbmem .New ()
67
68
68
69
var (
69
70
base = serpent .String ("system@dev.coder.com" )
@@ -78,16 +79,16 @@ func TestEntry(t *testing.T) {
78
79
// Validate that it returns that value.
79
80
require .Equal (t , base .String (), field .String ())
80
81
// Validate that there is no org-level override right now.
81
- _ , err := field .Resolve (ctx , mgr )
82
+ _ , err := field .Resolve (ctx , mgr . DeploymentResolver ( db ) )
82
83
require .ErrorIs (t , err , runtimeconfig .EntryNotFound )
83
84
// Coalesce returns the deployment-wide value.
84
- val , err := field .Coalesce (ctx , mgr )
85
+ val , err := field .Coalesce (ctx , mgr . DeploymentResolver ( db ) )
85
86
require .NoError (t , err )
86
87
require .Equal (t , base .String (), val .String ())
87
88
// Set an org-level override.
88
- require .NoError (t , field .SetRuntimeValue (ctx , mgr , & override ))
89
+ require .NoError (t , field .SetRuntimeValue (ctx , mgr . DeploymentResolver ( db ) , & override ))
89
90
// Coalesce now returns the org-level value.
90
- val , err = field .Coalesce (ctx , mgr )
91
+ val , err = field .Coalesce (ctx , mgr . DeploymentResolver ( db ) )
91
92
require .NoError (t , err )
92
93
require .Equal (t , override .String (), val .String ())
93
94
})
@@ -96,7 +97,8 @@ func TestEntry(t *testing.T) {
96
97
t .Parallel ()
97
98
98
99
ctx := testutil .Context (t , testutil .WaitShort )
99
- mgr := runtimeconfig .NewStoreManager (dbmem .New ())
100
+ mgr := runtimeconfig .NewStoreManager ()
101
+ db := dbmem .New ()
100
102
101
103
var (
102
104
base = serpent.Struct [map [string ]string ]{
@@ -117,16 +119,16 @@ func TestEntry(t *testing.T) {
117
119
// Check that default has been set.
118
120
require .Equal (t , base .String (), field .StartupValue ().String ())
119
121
// Validate that there is no org-level override right now.
120
- _ , err := field .Resolve (ctx , mgr )
122
+ _ , err := field .Resolve (ctx , mgr . DeploymentResolver ( db ) )
121
123
require .ErrorIs (t , err , runtimeconfig .EntryNotFound )
122
124
// Coalesce returns the deployment-wide value.
123
- val , err := field .Coalesce (ctx , mgr )
125
+ val , err := field .Coalesce (ctx , mgr . DeploymentResolver ( db ) )
124
126
require .NoError (t , err )
125
127
require .Equal (t , base .Value , val .Value )
126
128
// Set an org-level override.
127
- require .NoError (t , field .SetRuntimeValue (ctx , mgr , & override ))
129
+ require .NoError (t , field .SetRuntimeValue (ctx , mgr . DeploymentResolver ( db ) , & override ))
128
130
// Coalesce now returns the org-level value.
129
- structVal , err := field .Resolve (ctx , mgr )
131
+ structVal , err := field .Resolve (ctx , mgr . DeploymentResolver ( db ) )
130
132
require .NoError (t , err )
131
133
require .Equal (t , override .Value , structVal .Value )
132
134
})
0 commit comments