Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fseldow committed Dec 9, 2024
1 parent 37515d7 commit 8ca16e7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
44 changes: 44 additions & 0 deletions spec/parts/linux/cloud-init/artifacts/cse_helpers_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,48 @@ Describe 'cse_helpers.sh'
The variable KUBELET_NODE_LABELS should equal ''
End
End

Describe 'updateKubeBinaryRegistryURL'
logs_to_events() {
echo "mock logs to events calling with $1"
}
K8S_REGISTRY_REPO="oss/binaries/kubernetes"
It 'returns KUBE_BINARY_URL if it is already registry url'
KUBE_BINARY_URL="mcr.microsoft.com/oss/binaries/kubernetes/kubernetes-node:v1.30.0-linux-amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$KUBE_BINARY_URL"
The output line 1 should equal "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
End
It 'returns expected output from KUBE_BINARY_URL'
KUBE_BINARY_URL="https://acs-mirror.azureedge.net/kubernetes/v1.30.0-hotfix20241209/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-hotfix20241209-linux-amd64"
The output line 1 should equal "Extracted version: v1.30.0-hotfix20241209 from KUBE_BINARY_URL: $KUBE_BINARY_URL"
End
It 'returns expected output for moonckae acs-mirror'
KUBE_BINARY_URL="https://acs-mirror.azureedge.cn/kubernetes/v1.30.0-alpha/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-alpha-linux-amd64"
The output line 1 should equal "Extracted version: v1.30.0-alpha from KUBE_BINARY_URL: $KUBE_BINARY_URL"
End
It 'uses KUBENETES_VERSION if KUBE_BINARY_URL is invalid'
KUBE_BINARY_URL="https://invalidpath/v1.30.0-lts100/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-linux-amd64"
The output line 1 should equal "KUBE_BINARY_URL is formatted unexpectedly, will use the kubernetes version as binary version: v$KUBERNETES_VERSION"
End
End
End
44 changes: 0 additions & 44 deletions spec/parts/linux/cloud-init/artifacts/cse_install_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,48 +65,4 @@ Describe 'cse_install.sh'
The output line 3 should equal "mock installContainerdWithManifestJson calling"
End
End

Describe 'updateKubeBinaryRegistryURL'
logs_to_events() {
echo "mock logs to events calling with $1"
}
It 'returns KUBE_BINARY_URL if it is already registry url'
KUBE_BINARY_URL="mcr.microsoft.com/oss/binaries/kubernetes/kubernetes-node:v1.30.0-linux-amd64"
KUBERNETES_VERSION="1.30.0"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$KUBE_BINARY_URL"
The output line 1 should equal "KUBE_BINARY_URL is a registry url, will use it to pull the kube binary"
End
It 'returns expected output from KUBE_BINARY_URL'
KUBE_BINARY_URL="https://acs-mirror.azureedge.net/kubernetes/v1.30.0-hotfix20241209/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-hotfix20241209-linux-amd64"
The output line 1 should equal "Extracted version: v1.30.0-hotfix20241209 from KUBE_BINARY_URL: $KUBE_BINARY_URL"
End
It 'returns expected output for moonckae acs-mirror'
KUBE_BINARY_URL="https://acs-mirror.azureedge.cn/kubernetes/v1.30.0-alpha/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-alpha-linux-amd64"
The output line 1 should equal "Extracted version: v1.30.0-alpha from KUBE_BINARY_URL: $KUBE_BINARY_URL"
End
It 'uses KUBENETES_VERSION if KUBE_BINARY_URL is invalid'
KUBE_BINARY_URL="https://invalidpath/v1.30.0-lts100/binaries/kubernetes-nodes-linux-amd64.tar.gz"
BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER="mcr.microsoft.com"
KUBERNETES_VERSION="1.30.0"
CPU_ARCH="amd64"
updateKubeBinaryRegistryURL
When call updateKubeBinaryRegistryURL
The variable KUBE_BINARY_REGISTRY_URL should equal "$BOOTSTRAP_PROFILE_CONTAINER_REGISTRY_SERVER/oss/binaries/kubernetes/kubernetes-node:v1.30.0-linux-amd64"
The output line 1 should equal "KUBE_BINARY_URL is formatted unexpectedly, will use the kubernetes version as binary version: v$KUBERNETES_VERSION"
End
End
End

0 comments on commit 8ca16e7

Please sign in to comment.