5
5
6
6
"github.com/stretchr/testify/require"
7
7
8
+ "github.com/coder/coder/coderd/util/ptr"
8
9
"github.com/coder/coder/codersdk"
9
10
)
10
11
@@ -72,8 +73,8 @@ func TestParameterResolver_ValidateResolve_PrevInvalid(t *testing.T) {
72
73
p := codersdk.TemplateVersionParameter {
73
74
Name : "n" ,
74
75
Type : "number" ,
75
- ValidationMax : 10 ,
76
- ValidationMin : 1 ,
76
+ ValidationMax : ptr . Ref ( int32 ( 10 )) ,
77
+ ValidationMin : ptr . Ref ( int32 ( 1 )) ,
77
78
}
78
79
v , err := uut .ValidateResolve (p , nil )
79
80
require .Error (t , err )
@@ -89,8 +90,8 @@ func TestParameterResolver_ValidateResolve_DefaultInvalid(t *testing.T) {
89
90
p := codersdk.TemplateVersionParameter {
90
91
Name : "n" ,
91
92
Type : "number" ,
92
- ValidationMax : 10 ,
93
- ValidationMin : 1 ,
93
+ ValidationMax : ptr . Ref ( int32 ( 10 )) ,
94
+ ValidationMin : ptr . Ref ( int32 ( 1 )) ,
94
95
DefaultValue : "11" ,
95
96
}
96
97
v , err := uut .ValidateResolve (p , nil )
@@ -221,19 +222,19 @@ func TestRichParameterValidation(t *testing.T) {
221
222
222
223
numberRichParameters := []codersdk.TemplateVersionParameter {
223
224
{Name : stringParameterName , Type : "string" , Mutable : true },
224
- {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : 3 , ValidationMax : 10 },
225
+ {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : ptr . Ref ( int32 ( 3 )) , ValidationMax : ptr . Ref ( int32 ( 10 )) },
225
226
{Name : boolParameterName , Type : "bool" , Mutable : true },
226
227
}
227
228
228
229
monotonicIncreasingNumberRichParameters := []codersdk.TemplateVersionParameter {
229
230
{Name : stringParameterName , Type : "string" , Mutable : true },
230
- {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : 3 , ValidationMax : 10 , ValidationMonotonic : "increasing" },
231
+ {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : ptr . Ref ( int32 ( 3 )) , ValidationMax : ptr . Ref ( int32 ( 10 )) , ValidationMonotonic : "increasing" },
231
232
{Name : boolParameterName , Type : "bool" , Mutable : true },
232
233
}
233
234
234
235
monotonicDecreasingNumberRichParameters := []codersdk.TemplateVersionParameter {
235
236
{Name : stringParameterName , Type : "string" , Mutable : true },
236
- {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : 3 , ValidationMax : 10 , ValidationMonotonic : "decreasing" },
237
+ {Name : numberParameterName , Type : "number" , Mutable : true , ValidationMin : ptr . Ref ( int32 ( 3 )) , ValidationMax : ptr . Ref ( int32 ( 10 )) , ValidationMonotonic : "decreasing" },
237
238
{Name : boolParameterName , Type : "bool" , Mutable : true },
238
239
}
239
240
0 commit comments