Skip to content

Commit

Permalink
implement snapstore proxy config in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eaudetcobello committed Oct 2, 2024
1 parent 389f839 commit f34c779
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
15 changes: 11 additions & 4 deletions pkg/cloudinit/controlplane_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ func TestNewInitControlPlane(t *testing.T) {

config, err := cloudinit.NewInitControlPlane(cloudinit.InitControlPlaneInput{
BaseUserData: cloudinit.BaseUserData{
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
SnapstoreProxyScheme: "http",
SnapstoreProxyDomain: "snapstore.io",
SnapstoreProxyID: "abcd-1234-xyz",
ExtraFiles: []cloudinit.File{{
Path: "/tmp/file",
Content: "test file",
Expand All @@ -56,6 +59,7 @@ func TestNewInitControlPlane(t *testing.T) {
"set -x",
"prerun1",
"prerun2",
"/capi/scripts/configure-snapstore-proxy.sh",
"/capi/scripts/install.sh",
"/capi/scripts/bootstrap.sh",
"/capi/scripts/load-images.sh",
Expand Down Expand Up @@ -86,6 +90,9 @@ func TestNewInitControlPlane(t *testing.T) {
HaveField("Path", "/capi/etc/token"),
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/capi/manifests/00-k8sd-proxy.yaml"),
HaveField("Path", "/capi/etc/snapstore-proxy-scheme"),
HaveField("Path", "/capi/etc/snapstore-proxy-domain"),
HaveField("Path", "/capi/etc/snapstore-proxy-id"),
HaveField("Path", "/tmp/file"),
), "Some /capi/scripts files are missing")
}
Expand Down
15 changes: 11 additions & 4 deletions pkg/cloudinit/controlplane_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ func TestNewJoinControlPlane(t *testing.T) {

config, err := cloudinit.NewJoinControlPlane(cloudinit.JoinControlPlaneInput{
BaseUserData: cloudinit.BaseUserData{
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
SnapstoreProxyScheme: "http",
SnapstoreProxyDomain: "snapstore.io",
SnapstoreProxyID: "abcd-1234-xyz",
ExtraFiles: []cloudinit.File{{
Path: "/tmp/file",
Content: "test file",
Expand All @@ -39,6 +42,7 @@ func TestNewJoinControlPlane(t *testing.T) {
"set -x",
"prerun1",
"prerun2",
"/capi/scripts/configure-snapstore-proxy.sh",
"/capi/scripts/install.sh",
"/capi/scripts/load-images.sh",
"/capi/scripts/join-cluster.sh",
Expand Down Expand Up @@ -66,6 +70,9 @@ func TestNewJoinControlPlane(t *testing.T) {
HaveField("Path", "/capi/etc/node-token"),
HaveField("Path", "/capi/etc/join-token"),
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/capi/etc/snapstore-proxy-scheme"),
HaveField("Path", "/capi/etc/snapstore-proxy-domain"),
HaveField("Path", "/capi/etc/snapstore-proxy-id"),
HaveField("Path", "/tmp/file"),
), "Some /capi/scripts files are missing")
}
Expand Down
1 change: 0 additions & 1 deletion pkg/cloudinit/worker_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func NewJoinWorker(input JoinWorkerInput) (CloudConfig, error) {
config.RunCommands = append(config.RunCommands, "/capi/scripts/install.sh")
}
config.RunCommands = append(config.RunCommands,
"/capi/scripts/configure-snapstore-proxy.sh",
"/capi/scripts/load-images.sh",
"/capi/scripts/join-cluster.sh",
"/capi/scripts/configure-node-token.sh",
Expand Down
15 changes: 11 additions & 4 deletions pkg/cloudinit/worker_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ func TestNewJoinWorker(t *testing.T) {

config, err := cloudinit.NewJoinWorker(cloudinit.JoinWorkerInput{
BaseUserData: cloudinit.BaseUserData{
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
KubernetesVersion: "v1.30.0",
BootCommands: []string{"bootcmd"},
PreRunCommands: []string{"prerun1", "prerun2"},
PostRunCommands: []string{"postrun1", "postrun2"},
SnapstoreProxyScheme: "http",
SnapstoreProxyDomain: "snapstore.io",
SnapstoreProxyID: "abcd-1234-xyz",
ExtraFiles: []cloudinit.File{{
Path: "/tmp/file",
Content: "test file",
Expand All @@ -40,6 +43,7 @@ func TestNewJoinWorker(t *testing.T) {
"set -x",
"prerun1",
"prerun2",
"/capi/scripts/configure-snapstore-proxy.sh",
"/capi/scripts/install.sh",
"/capi/scripts/load-images.sh",
"/capi/scripts/join-cluster.sh",
Expand All @@ -66,6 +70,9 @@ func TestNewJoinWorker(t *testing.T) {
HaveField("Path", "/capi/etc/node-token"),
HaveField("Path", "/capi/etc/join-token"),
HaveField("Path", "/capi/etc/snap-track"),
HaveField("Path", "/capi/etc/snapstore-proxy-scheme"),
HaveField("Path", "/capi/etc/snapstore-proxy-domain"),
HaveField("Path", "/capi/etc/snapstore-proxy-id"),
HaveField("Path", "/tmp/file"),
), "Some /capi/scripts files are missing")
}
Expand Down

0 comments on commit f34c779

Please sign in to comment.