Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Dec 13, 2020
1 parent d2b34ea commit 1c6618b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 68 deletions.
55 changes: 0 additions & 55 deletions pkg/model/components/containerd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,61 +36,6 @@ func buildContainerdCluster(version string) *kopsapi.Cluster {
}
}

func Test_Build_Containerd_Unsupported_Version(t *testing.T) {
kubernetesVersions := []string{"1.4.8", "1.5.2", "1.9.0", "1.10.11"}
for _, v := range kubernetesVersions {

c := buildContainerdCluster(v)
c.Spec.ContainerRuntime = "containerd"
b := assets.NewAssetBuilder(c, "")

version, err := util.ParseKubernetesVersion(v)
if err != nil {
t.Fatalf("unexpected error from ParseKubernetesVersion %s: %v", v, err)
}

ob := &ContainerdOptionsBuilder{
&OptionsContext{
AssetBuilder: b,
KubernetesVersion: *version,
},
}

err = ob.BuildOptions(&c.Spec)
if err == nil {
t.Fatalf("expecting error from BuildOptions when Kubernetes version < 1.11: %s", v)
}
}
}

func Test_Build_Containerd_Untested_Version(t *testing.T) {
kubernetesVersions := []string{"1.11.0", "1.11.2", "1.14.0", "1.16.3"}

for _, v := range kubernetesVersions {

c := buildContainerdCluster(v)
c.Spec.ContainerRuntime = "containerd"
b := assets.NewAssetBuilder(c, "")

version, err := util.ParseKubernetesVersion(v)
if err != nil {
t.Fatalf("unexpected error from ParseKubernetesVersion %s: %v", v, err)
}

ob := &ContainerdOptionsBuilder{
&OptionsContext{
AssetBuilder: b,
KubernetesVersion: *version,
},
}

err = ob.BuildOptions(&c.Spec)
if err == nil {
t.Fatalf("expecting error when Kubernetes version >= 1.11 and < 1.18: %s", v)
}
}
}

func Test_Build_Containerd_Supported_Version(t *testing.T) {
kubernetesVersions := []string{"1.18.0", "1.18.3"}

Expand Down
26 changes: 13 additions & 13 deletions upup/pkg/fi/cloudup/containerd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ func TestContainerdVersionUrlHash(t *testing.T) {
{
arch: architectures.ArchitectureArm64,
version: "1.3.4",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-19.03.11.tgz",
hash: "9cd49fe82f6b7ec413b04daef35bc0c87b01d6da67611e5beef36291538d3145",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-20.10.0.tgz",
hash: "6e3f80e8451ecbe7b3559247721c3e226be6b228acaadee7e13683f80c20e81c",
err: nil,
},
{
arch: architectures.ArchitectureAmd64,
version: "1.3.7",
url: "https://download.docker.com/linux/static/stable/x86_64/docker-19.03.13.tgz",
hash: "ddb13aff1fcdcceb710bf71a210169b9c1abfd7420eeaf42cf7975f8fae2fcc8",
version: "1.3.9",
url: "https://github.com/containerd/containerd/releases/download/v1.3.9/cri-containerd-cni-1.3.9-linux-amd64.tar.gz",
hash: "96663699e0f888fbf232ae6629a367aa7421f6b95044e7ee5d4d4e02841fac75",
err: nil,
},
{
arch: architectures.ArchitectureArm64,
version: "1.3.7",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-19.03.13.tgz",
hash: "bdf080af7d6f383ad80e415e9c1952a63c7038c149dc673b7598bfca4d3311ec",
version: "1.3.9",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-20.10.0.tgz",
hash: "6e3f80e8451ecbe7b3559247721c3e226be6b228acaadee7e13683f80c20e81c",
err: nil,
},
{
Expand All @@ -71,8 +71,8 @@ func TestContainerdVersionUrlHash(t *testing.T) {
{
arch: architectures.ArchitectureArm64,
version: "1.4.1",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-19.03.11.tgz",
hash: "9cd49fe82f6b7ec413b04daef35bc0c87b01d6da67611e5beef36291538d3145",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-20.10.0.tgz",
hash: "6e3f80e8451ecbe7b3559247721c3e226be6b228acaadee7e13683f80c20e81c",
err: nil,
},
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func TestContainerdVersionUrl(t *testing.T) {
{
arch: architectures.ArchitectureArm64,
version: "1.3.4",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-19.03.11.tgz",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-20.10.0.tgz",
err: nil,
},
{
Expand All @@ -171,7 +171,7 @@ func TestContainerdVersionUrl(t *testing.T) {
{
arch: architectures.ArchitectureArm64,
version: "1.4.1",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-19.03.11.tgz",
url: "https://download.docker.com/linux/static/stable/aarch64/docker-20.10.0.tgz",
err: nil,
},
}
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestContainerdVersionHash(t *testing.T) {
{
arch: architectures.ArchitectureArm64,
version: "1.4.1",
hash: "9cd49fe82f6b7ec413b04daef35bc0c87b01d6da67611e5beef36291538d3145",
hash: "6e3f80e8451ecbe7b3559247721c3e226be6b228acaadee7e13683f80c20e81c",
err: nil,
},
}
Expand Down

0 comments on commit 1c6618b

Please sign in to comment.