Skip to content

Commit

Permalink
Fixing the tab <-> char issues reported within the PR. Replace diff w…
Browse files Browse the repository at this point in the history
…ith Testify Assert which simplifies comparisons and improve testing readibility

Signed-off-by: cmoulliard <[email protected]>
  • Loading branch information
cmoulliard committed Oct 19, 2023
1 parent 30589d9 commit 8034b46
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/docker/go-connections v0.4.0
github.com/google/go-cmp v0.5.9
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
k8s.io/api v0.26.2
k8s.io/apiextensions-apiserver v0.24.2
k8s.io/apimachinery v0.26.2
Expand Down Expand Up @@ -103,6 +104,7 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
Expand Down
36 changes: 16 additions & 20 deletions pkg/kind/cluster_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package kind

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/google/go-cmp/cmp"
)

func TestGetConfig(t *testing.T) {
Expand All @@ -24,36 +23,33 @@ apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5001"]
endpoint = ["http://idpbuilder-testcase-registry:5000"]
endpoint = ["http://idpbuilder-testcase-registry:5000"]
nodes:
- role: control-plane
image: "kindest/node:v1.26.3"
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=4Gi
node-labels: "ingress-ready=true"
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=4Gi
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 8880
protocol: TCP
hostPort: 8880
protocol: TCP
- containerPort: 443
hostPort: 8443
protocol: TCP
hostPort: 8443
protocol: TCP
-
- role: worker
image: "kindest/node:v1.26.3"
kubeadmConfigPatches:
- |
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=4Gi`
kind: JoinConfiguration
nodeRegistration:
kubeletExtraArgs:
system-reserved: memory=4Gi`

t.Errorf("Got config: %s", string(cfg))
if diff := cmp.Diff(expectConfig, string(cfg)); diff != "" {
t.Errorf("Expected config mismatch (-want +got):\n%s", diff)
}
assert.Equal(t, expectConfig, string(cfg))
}

0 comments on commit 8034b46

Please sign in to comment.