Skip to content

Commit dcbce18

Browse files
committed
use different assert lib
1 parent 1bdf9c2 commit dcbce18

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.19
55
require (
66
github.com/argoproj/argo-cd/v2 v2.5.0
77
github.com/argoproj/argo-workflows/v3 v3.3.5
8-
github.com/magiconair/properties v1.8.5
8+
github.com/stretchr/testify v1.7.1
99
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
1010
)
1111

@@ -96,7 +96,6 @@ require (
9696
github.com/sirupsen/logrus v1.8.1 // indirect
9797
github.com/spf13/cobra v1.5.0 // indirect
9898
github.com/spf13/pflag v1.0.5 // indirect
99-
github.com/stretchr/testify v1.7.1 // indirect
10099
github.com/vmihailenco/go-tinylfu v0.2.1 // indirect
101100
github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect
102101
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ github.com/lpabon/godbc v0.1.1/go.mod h1:Jo9QV0cf3U6jZABgiJ2skINAXb9j8m51r07g4KI
549549
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
550550
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
551551
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
552-
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
553552
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
554553
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
555554
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=

internal/plugin_test.go

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import (
1010
"testing"
1111

1212
"github.com/argoproj/argo-workflows/v3/pkg/plugins/executor"
13-
"github.com/magiconair/properties/assert"
13+
"github.com/stretchr/testify/assert"
1414
)
1515

1616
var (
17-
headerEmpty = map[string]string{}
18-
headerContentJson = map[string]string{"Content-Type": "application/json"}
19-
headerContentEncoded = map[string]string{"Content-Type": "application/x-www-form-urlencoded"}
20-
validWorkflowBody = []byte(
21-
`{
17+
headerEmpty = map[string]string{}
18+
headerContentJson = map[string]string{"Content-Type": "application/json"}
19+
headerContentEncoded = map[string]string{"Content-Type": "application/x-www-form-urlencoded"}
20+
validWorkflowBody = []byte(
21+
`{
2222
"workflow": {
2323
"metadata": {
2424
"name": "test-template"
@@ -39,11 +39,11 @@ var (
3939
type errReader int
4040

4141
func (errReader) Read(_ []byte) (n int, err error) {
42-
return 0, errors.New("read error")
42+
return 0, errors.New("read error")
4343
}
4444

4545
type executorSpy struct {
46-
Called bool
46+
Called bool
4747
}
4848

4949
func (e *executorSpy) Execute(_ executor.ExecuteTemplateArgs) executor.ExecuteTemplateReply {
@@ -55,16 +55,16 @@ func (e *executorSpy) Execute(_ executor.ExecuteTemplateArgs) executor.ExecuteTe
5555
func TestArgocdPlugin(t *testing.T) {
5656
// test returning correct result based on input
5757

58-
spy := executorSpy{}
58+
spy := executorSpy{}
5959
argocdPlugin := ArgocdPlugin(&spy)
6060
handler := http.HandlerFunc(argocdPlugin)
6161

6262
var failTests = []struct {
63-
name string
64-
body io.Reader
63+
name string
64+
body io.Reader
6565
headers map[string]string
66-
want string
67-
status int
66+
want string
67+
status int
6868
}{
6969
{
7070
name: "fail header content-type is empty",
@@ -104,7 +104,7 @@ func TestArgocdPlugin(t *testing.T) {
104104
}
105105
response := httptest.NewRecorder()
106106
handler.ServeHTTP(response, request)
107-
107+
108108
got := strings.Trim(response.Body.String(), "\n")
109109
gotStatus := response.Result().StatusCode
110110

@@ -114,18 +114,18 @@ func TestArgocdPlugin(t *testing.T) {
114114
}
115115

116116
var execTests = []struct {
117-
name string
118-
fail bool
117+
name string
118+
fail bool
119119
status int
120120
}{
121121
{
122-
name: "exec without fail",
123-
fail: false,
122+
name: "exec without fail",
123+
fail: false,
124124
status: http.StatusOK,
125125
},
126126
{
127-
name: "exec fails",
128-
fail: true,
127+
name: "exec fails",
128+
fail: true,
129129
status: http.StatusInternalServerError,
130130
},
131131
}
@@ -138,7 +138,7 @@ func TestArgocdPlugin(t *testing.T) {
138138
request.Header.Set("Content-Type", "application/json")
139139
response := httptest.NewRecorder()
140140
handler.ServeHTTP(response, request)
141-
141+
142142
if !spy.Called && !tt.fail {
143143
t.Error("ApiExecutor was not called")
144144
}
@@ -148,6 +148,5 @@ func TestArgocdPlugin(t *testing.T) {
148148
assert.Equal(t, got, tt.status)
149149
assert.Equal(t, got, tt.status)
150150
})
151-
}
151+
}
152152
}
153-

0 commit comments

Comments
 (0)