Skip to content

Commit

Permalink
Inline HaveField
Browse files Browse the repository at this point in the history
  • Loading branch information
mateoflorido committed Jul 9, 2024
1 parent 732d522 commit e5d3ac5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions pkg/cloudinit/controlplane_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestNewInitControlPlane(t *testing.T) {
}))

// NOTE (mateoflorido): Keep this test in sync with the expected paths in the controlplane_init.go file.
expectedPaths := []interface{}{
g.Expect(config.WriteFiles).To(ConsistOf(
HaveField("Path", "/capi/scripts/install.sh"),
HaveField("Path", "/capi/scripts/bootstrap.sh"),
HaveField("Path", "/capi/scripts/load-images.sh"),
Expand All @@ -83,9 +83,7 @@ func TestNewInitControlPlane(t *testing.T) {
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/capi/manifests/00-k8sd-proxy.yaml"),
HaveField("Path", "/tmp/file"),
}

g.Expect(config.WriteFiles).To(ConsistOf(expectedPaths...), "Some /capi/scripts files are missing")
), "Some /capi/scripts files are missing")
}

func TestNewInitControlPlaneInvalidVersionError(t *testing.T) {
Expand Down
6 changes: 2 additions & 4 deletions pkg/cloudinit/controlplane_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNewJoinControlPlane(t *testing.T) {
}))

// NOTE (mateoflorido): Keep this test in sync with the expected paths in the controlplane_join.go file.
expectedPaths := []interface{}{
g.Expect(config.WriteFiles).To(ConsistOf(
HaveField("Path", "/capi/scripts/install.sh"),
HaveField("Path", "/capi/scripts/bootstrap.sh"),
HaveField("Path", "/capi/scripts/load-images.sh"),
Expand All @@ -63,9 +63,7 @@ func TestNewJoinControlPlane(t *testing.T) {
HaveField("Path", "/capi/etc/join-token"),
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/tmp/file"),
}

g.Expect(config.WriteFiles).To(ConsistOf(expectedPaths...), "Some /capi/scripts files are missing")
), "Some /capi/scripts files are missing")
}

func TestNewJoinControlPlaneInvalidVersionError(t *testing.T) {
Expand Down
6 changes: 2 additions & 4 deletions pkg/cloudinit/worker_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNewJoinWorker(t *testing.T) {
}))

// NOTE (mateoflorido): Keep this test in sync with the expected paths in the worker_join.go file.
expectedPaths := []interface{}{
g.Expect(config.WriteFiles).To(ConsistOf(
HaveField("Path", "/capi/scripts/install.sh"),
HaveField("Path", "/capi/scripts/bootstrap.sh"),
HaveField("Path", "/capi/scripts/load-images.sh"),
Expand All @@ -63,9 +63,7 @@ func TestNewJoinWorker(t *testing.T) {
HaveField("Path", "/capi/etc/join-token"),
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/tmp/file"),
}

g.Expect(config.WriteFiles).To(ConsistOf(expectedPaths...), "Some /capi/scripts files are missing")
), "Some /capi/scripts files are missing")
}

func TestNewJoinWorkerInvalidVersionError(t *testing.T) {
Expand Down

0 comments on commit e5d3ac5

Please sign in to comment.