Skip to content

Commit 202fa98

Browse files
authored
update tests and utils to use boolean pointers (#115)
* update tests and utils to use boolean pointers * isTrue declaration
1 parent 7c5ff63 commit 202fa98

File tree

6 files changed

+361
-59
lines changed

6 files changed

+361
-59
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/devfile/library
33
go 1.15
44

55
require (
6-
github.com/devfile/api/v2 v2.0.0-20210910153124-da620cd1a7a1
6+
github.com/devfile/api/v2 v2.0.0-20210914125740-da05a3e14c3b
77
github.com/fatih/color v1.7.0
88
github.com/gobwas/glob v0.2.3
99
github.com/golang/mock v1.5.0

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ
8383
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8484
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
8585
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
86-
github.com/devfile/api/v2 v2.0.0-20210910153124-da620cd1a7a1 h1:k25KKenebyxOUnGmGTZE0F/wHDQ+fh+HoxVfjsKXNv0=
87-
github.com/devfile/api/v2 v2.0.0-20210910153124-da620cd1a7a1/go.mod h1:kLX/nW93gigOHXK3NLeJL2fSS/sgEe+OHu8bo3aoOi4=
86+
github.com/devfile/api/v2 v2.0.0-20210914125740-da05a3e14c3b h1:OSORBTgmRBJUKbZhGJJn+CH7gyY4IBdARn9pJpnqyBs=
87+
github.com/devfile/api/v2 v2.0.0-20210914125740-da05a3e14c3b/go.mod h1:kLX/nW93gigOHXK3NLeJL2fSS/sgEe+OHu8bo3aoOi4=
8888
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
8989
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
9090
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
@@ -223,7 +223,6 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
223223
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
224224
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
225225
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
226-
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
227226
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
228227
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
229228
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=

pkg/devfile/generator/utils_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"k8s.io/apimachinery/pkg/util/intstr"
2323
)
2424

25+
var isTrue bool = true
26+
2527
func TestConvertEnvs(t *testing.T) {
2628
envVarsNames := []string{"test", "sample-var", "myvar"}
2729
envVarsValues := []string{"value1", "value2", "value3"}
@@ -984,7 +986,7 @@ func TestGetPortExposure(t *testing.T) {
984986
{
985987
Name: urlName2,
986988
TargetPort: 9090,
987-
Secure: true,
989+
Secure: &isTrue,
988990
Path: "/testpath",
989991
Exposure: v1.InternalEndpointExposure,
990992
Protocol: v1.HTTPSEndpointProtocol,
@@ -1038,7 +1040,7 @@ func TestGetPortExposure(t *testing.T) {
10381040
{
10391041
Name: urlName2,
10401042
TargetPort: 9090,
1041-
Secure: true,
1043+
Secure: &isTrue,
10421044
Path: "/testpath",
10431045
Exposure: v1.InternalEndpointExposure,
10441046
Protocol: v1.HTTPSEndpointProtocol,

pkg/devfile/parser/data/v2/common/command_helper_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
v1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
99
)
1010

11+
var isTrue bool = true
12+
1113
func TestGetGroup(t *testing.T) {
1214

1315
tests := []struct {
@@ -24,7 +26,7 @@ func TestGetGroup(t *testing.T) {
2426
LabeledCommand: v1.LabeledCommand{
2527
BaseCommand: v1.BaseCommand{
2628
Group: &v1.CommandGroup{
27-
IsDefault: true,
29+
IsDefault: &isTrue,
2830
Kind: v1.RunCommandGroupKind,
2931
},
3032
},
@@ -33,7 +35,7 @@ func TestGetGroup(t *testing.T) {
3335
},
3436
},
3537
want: &v1.CommandGroup{
36-
IsDefault: true,
38+
IsDefault: &isTrue,
3739
Kind: v1.RunCommandGroupKind,
3840
},
3941
},
@@ -46,7 +48,7 @@ func TestGetGroup(t *testing.T) {
4648
LabeledCommand: v1.LabeledCommand{
4749
BaseCommand: v1.BaseCommand{
4850
Group: &v1.CommandGroup{
49-
IsDefault: true,
51+
IsDefault: &isTrue,
5052
Kind: v1.BuildCommandGroupKind,
5153
},
5254
},
@@ -55,7 +57,7 @@ func TestGetGroup(t *testing.T) {
5557
},
5658
},
5759
want: &v1.CommandGroup{
58-
IsDefault: true,
60+
IsDefault: &isTrue,
5961
Kind: v1.BuildCommandGroupKind,
6062
},
6163
},
@@ -73,7 +75,7 @@ func TestGetGroup(t *testing.T) {
7375
LabeledCommand: v1.LabeledCommand{
7476
BaseCommand: v1.BaseCommand{
7577
Group: &v1.CommandGroup{
76-
IsDefault: true,
78+
IsDefault: &isTrue,
7779
Kind: v1.TestCommandGroupKind,
7880
},
7981
},
@@ -82,7 +84,7 @@ func TestGetGroup(t *testing.T) {
8284
},
8385
},
8486
want: &v1.CommandGroup{
85-
IsDefault: true,
87+
IsDefault: &isTrue,
8688
Kind: v1.TestCommandGroupKind,
8789
},
8890
},
@@ -95,7 +97,7 @@ func TestGetGroup(t *testing.T) {
9597
LabeledCommand: v1.LabeledCommand{
9698
BaseCommand: v1.BaseCommand{
9799
Group: &v1.CommandGroup{
98-
IsDefault: true,
100+
IsDefault: &isTrue,
99101
Kind: v1.BuildCommandGroupKind,
100102
},
101103
},
@@ -104,7 +106,7 @@ func TestGetGroup(t *testing.T) {
104106
},
105107
},
106108
want: &v1.CommandGroup{
107-
IsDefault: true,
109+
IsDefault: &isTrue,
108110
Kind: v1.BuildCommandGroupKind,
109111
},
110112
},

0 commit comments

Comments
 (0)