Skip to content

Commit

Permalink
Enable tests related to Helm 3.2 bin. (helm#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Pratik Jagrut <[email protected]>
  • Loading branch information
pratikjagrut authored and pedjak committed Dec 16, 2020
1 parent 8240b23 commit 73c0800
Showing 1 changed file with 42 additions and 69 deletions.
111 changes: 42 additions & 69 deletions scripts/completion-tests/completionTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ EOF

allHelmCommands="completion create dependency env 2to3 get history install lint list package plugin pull push push-artifactory repo rollback search show status template test uninstall upgrade verify version"
if [ "$SHELL_TYPE" = bash ]; then
allHelmGlobalFlags="--add-dir-header --alsologtostderr --debug --kube-context --kube-context= --kubeconfig --kubeconfig= --log-backtrace-at --log-backtrace-at= --log-dir --log-dir= --log-file --log-file-max-size --log-file-max-size= --log-file= --logtostderr --namespace --namespace= --registry-config --registry-config= --repository-cache --repository-cache= --repository-config --repository-config= --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold= --v --v= --vmodule --vmodule= -n -v"
allHelmLongFlags="--add-dir-header --alsologtostderr --debug --kube-context --kube-context= --kubeconfig --kubeconfig= --log-backtrace-at --log-backtrace-at= --log-dir --log-dir= --log-file --log-file-max-size --log-file-max-size= --log-file= --logtostderr --namespace --namespace= --registry-config --registry-config= --repository-cache --repository-cache= --repository-config --repository-config= --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold= --v --v= --vmodule --vmodule="
allHelmGlobalFlags="--add-dir-header --alsologtostderr --debug --kube-apiserver --kube-apiserver= --kube-context --kube-context= --kube-token --kube-token= --kubeconfig --kubeconfig= --log-backtrace-at --log-backtrace-at= --log-dir --log-dir= --log-file --log-file-max-size --log-file-max-size= --log-file= --logtostderr --namespace --namespace= --registry-config --registry-config= --repository-cache --repository-cache= --repository-config --repository-config= --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold= --v --v= --vmodule --vmodule= -n -v"
allHelmLongFlags="--add-dir-header --alsologtostderr --debug --kube-apiserver --kube-apiserver= --kube-context --kube-context= --kube-token --kube-token= --kubeconfig --kubeconfig= --log-backtrace-at --log-backtrace-at= --log-dir --log-dir= --log-file --log-file-max-size --log-file-max-size= --log-file= --logtostderr --namespace --namespace= --registry-config --registry-config= --repository-cache --repository-cache= --repository-config --repository-config= --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold= --v --v= --vmodule --vmodule="
else
allHelmGlobalFlags="--add-dir-header --alsologtostderr --debug --kube-context --kube-context --kube-context --kubeconfig --kubeconfig --kubeconfig --log-backtrace-at --log-backtrace-at --log-backtrace-at --log-dir --log-dir --log-dir --log-file --log-file --log-file --log-file-max-size --log-file-max-size --log-file-max-size --logtostderr --namespace --namespace --namespace --registry-config --registry-config --registry-config --repository-cache --repository-cache --repository-cache --repository-config --repository-config --repository-config --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold --stderrthreshold --v --v --v --vmodule --vmodule --vmodule -n -v"
allHelmLongFlags="--add-dir-header --alsologtostderr --debug --kube-context --kube-context --kube-context --kubeconfig --kubeconfig --kubeconfig --log-backtrace-at --log-backtrace-at --log-backtrace-at --log-dir --log-dir --log-dir --log-file --log-file --log-file --log-file-max-size --log-file-max-size --log-file-max-size --logtostderr --namespace --namespace --namespace --registry-config --registry-config --registry-config --repository-cache --repository-cache --repository-cache --repository-config --repository-config --repository-config --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold --stderrthreshold --v --v --v --vmodule --vmodule --vmodule"
allHelmGlobalFlags="--add-dir-header --alsologtostderr --debug --kube-apiserver --kube-apiserver --kube-apiserver --kube-context --kube-context --kube-context --kube-token --kube-token --kube-token --kubeconfig --kubeconfig --kubeconfig --log-backtrace-at --log-backtrace-at --log-backtrace-at --log-dir --log-dir --log-dir --log-file --log-file --log-file --log-file-max-size --log-file-max-size --log-file-max-size --logtostderr --namespace --namespace --namespace --registry-config --registry-config --registry-config --repository-cache --repository-cache --repository-cache --repository-config --repository-config --repository-config --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold --stderrthreshold --v --v --v --vmodule --vmodule --vmodule -n -v"
allHelmLongFlags="--add-dir-header --alsologtostderr --debug --kube-apiserver --kube-apiserver --kube-apiserver --kube-context --kube-context --kube-context --kube-token --kube-token --kube-token --kubeconfig --kubeconfig --kubeconfig --log-backtrace-at --log-backtrace-at --log-backtrace-at --log-dir --log-dir --log-dir --log-file --log-file --log-file --log-file-max-size --log-file-max-size --log-file-max-size --logtostderr --namespace --namespace --namespace --registry-config --registry-config --registry-config --repository-cache --repository-cache --repository-cache --repository-config --repository-config --repository-config --skip-headers --skip-log-headers --stderrthreshold --stderrthreshold --stderrthreshold --v --v --v --vmodule --vmodule --vmodule"
fi

#####################
Expand Down Expand Up @@ -324,34 +324,29 @@ _completionTests_verifyCompletion "helm dependenci" ""

# Static completion for plugins
_completionTests_verifyCompletion "helm push " ""
_completionTests_verifyCompletion "helm 2to3 " "cleanup convert move"
_completionTests_verifyCompletion "helm 2to3 c" "cleanup convert"
_completionTests_verifyCompletion "helm 2to3 move " "config"

_completionTests_verifyCompletion "helm 2to3 cleanup -" "$allHelmGlobalFlags -r -s --label --cleanup --storage"
# For plugin completion, when there are more short flags than long flags, a long flag is created for the extra short flags
# So here we expect the extra --t
_completionTests_verifyCompletion "helm 2to3 convert -" "$allHelmGlobalFlags -l -s -t --t --label --storage"
_completionTests_verifyCompletion "helm 2to3 move config --" "$allHelmLongFlags --dry-run"

# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "helm 2to3 " "cleanup convert move"
# _completionTests_verifyCompletion "helm 2to3 c" "cleanup convert"
# _completionTests_verifyCompletion "helm 2to3 move " "config"

# _completionTests_verifyCompletion "helm 2to3 cleanup -" "$allHelmGlobalFlags -r -s --label --cleanup --storage"
# # For plugin completion, when there are more short flags than long flags, a long flag is created for the extra short flags
# # So here we expect the extra --t
# _completionTests_verifyCompletion "helm 2to3 convert -" "$allHelmGlobalFlags -l -s -t --t --label --storage"
# _completionTests_verifyCompletion "helm 2to3 move config --" "$allHelmLongFlags --dry-run"

# #####################
# # Dynamic completions
# #####################

# # For release name completion
# _completionTests_verifyCompletion "helm status " "athos porthos aramis"
# _completionTests_verifyCompletion "helm history a" "athos aramis"
# _completionTests_verifyCompletion "helm uninstall a" "athos aramis"
# _completionTests_verifyCompletion "helm upgrade a" "athos aramis"
# _completionTests_verifyCompletion "helm get manifest -n default " "athos porthos aramis"
# _completionTests_verifyCompletion "helm --namespace gascony get manifest " "dartagnan"
# _completionTests_verifyCompletion "helm --namespace gascony test d" "dartagnan"
# _completionTests_verifyCompletion "helm rollback d" ""
# **********************************************************************
#####################
# Dynamic completions
#####################

# For release name completion
_completionTests_verifyCompletion "helm status " "athos porthos aramis"
_completionTests_verifyCompletion "helm history a" "athos aramis"
_completionTests_verifyCompletion "helm uninstall a" "athos aramis"
_completionTests_verifyCompletion "helm upgrade a" "athos aramis"
_completionTests_verifyCompletion "helm get manifest -n default " "athos porthos aramis"
_completionTests_verifyCompletion "helm --namespace gascony get manifest " "dartagnan"
_completionTests_verifyCompletion "helm --namespace gascony test d" "dartagnan"
_completionTests_verifyCompletion "helm rollback d" ""

# For the repo command
_completionTests_verifyCompletion "helm repo remove " "nginx zztest1 zztest2"
Expand All @@ -375,22 +370,18 @@ if [ ! -z ${ROBOT_HELM_V3} ]; then
XDG_DATA_HOME=$tmp
fi


# ********* This tests are commented beacuse they are for 3.2 *********
# # For the global --kube-context flag
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# # Feature not available in v2
# _completionTests_verifyCompletion "helm --kube-context " "dev1 dev2 accept prod"
# _completionTests_verifyCompletion "helm upgrade --kube-context " "dev1 dev2 accept prod"
# _completionTests_verifyCompletion "helm upgrade --kube-context d" "dev1 dev2"
# if [ "$SHELL_TYPE" = bash ]; then
# _completionTests_verifyCompletion "helm --kube-context=" "dev1 dev2 accept prod"
# else
# _completionTests_verifyCompletion "helm --kube-context=" "--kube-context=dev1 --kube-context=dev2 --kube-context=accept --kube-context=prod"
# fi
# fi
# **********************************************************************

# For the global --kube-context flag
if [ ! -z ${ROBOT_HELM_V3} ]; then
# Feature not available in v2
_completionTests_verifyCompletion "helm --kube-context " "dev1 dev2 accept prod"
_completionTests_verifyCompletion "helm upgrade --kube-context " "dev1 dev2 accept prod"
_completionTests_verifyCompletion "helm upgrade --kube-context d" "dev1 dev2"
if [ "$SHELL_TYPE" = bash ]; then
_completionTests_verifyCompletion "helm --kube-context=" "dev1 dev2 accept prod"
else
_completionTests_verifyCompletion "helm --kube-context=" "--kube-context=dev1 --kube-context=dev2 --kube-context=accept --kube-context=prod"
fi
fi

# Now requires a real cluster
# # For the global --namespace flag
Expand Down Expand Up @@ -548,10 +539,7 @@ if [ "$SHELL_TYPE" = bash ]; then
_completionTests_verifyCompletion "helmAlias get hooks --kubec" "--kubeconfig= --kubeconfig"
_completionTests_verifyCompletion "helmAlias repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "helmAlias plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "helmAlias upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "helmAlias upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "helmAlias --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand All @@ -563,10 +551,7 @@ if [ "$SHELL_TYPE" = bash ]; then
_completionTests_verifyCompletion "helmAliasWithVar get hooks --kubec" "--kubeconfig= --kubeconfig"
_completionTests_verifyCompletion "helmAliasWithVar repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "helmAliasWithVar plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "helmAliasWithVar upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "helmAliasWithVar upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "helmAliasWithVar --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand All @@ -577,10 +562,7 @@ _completionTests_verifyCompletion "$TMP_HELM_DIR/helm lis" "list"
_completionTests_verifyCompletion "$TMP_HELM_DIR/helm completion z" "zsh"
_completionTests_verifyCompletion "$TMP_HELM_DIR/helm repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "$TMP_HELM_DIR/helm plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "$TMP_HELM_DIR/helm upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "$TMP_HELM_DIR/helm upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "$TMP_HELM_DIR/helm --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand All @@ -598,10 +580,7 @@ _completionTests_verifyCompletion "./helm lis" "list"
_completionTests_verifyCompletion "./helm completion z" "zsh"
_completionTests_verifyCompletion "./helm repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "./helm plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "./helm upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "./helm upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "./helm --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand All @@ -626,10 +605,7 @@ _completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm lis" "list"
_completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm completion z" "zsh"
_completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "$TMP_HELM_DIR/myhelm --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand All @@ -647,10 +623,7 @@ _completionTests_verifyCompletion "myhelm lis" "list"
_completionTests_verifyCompletion "myhelm completion z" "zsh"
_completionTests_verifyCompletion "myhelm repo remove zztest" "zztest1 zztest2"
_completionTests_verifyCompletion "myhelm plugin update pus" "push push-artifactory"
# ********* This tests are commented beacuse they are for 3.2 *********
# _completionTests_verifyCompletion "myhelm upgrade --kube-context d" "dev1 dev2"
# **********************************************************************

_completionTests_verifyCompletion "myhelm upgrade --kube-context d" "dev1 dev2"
# if [ ! -z ${ROBOT_HELM_V3} ]; then
# _completionTests_verifyCompletion "myhelm --kube-context=mycontext --namespace " "braavos old-valyria yunkai"
# fi
Expand Down

0 comments on commit 73c0800

Please sign in to comment.