Skip to content

Commit

Permalink
Skip test when no credentials ready (#320)
Browse files Browse the repository at this point in the history
* Since fork PR build could not read secrets of GitHub action,
https://github.community/t5/GitHub-Actions/Allow-secrets-to-be-shared-with-trusted-Actions/td-p/34278
So skip test when its credentials are nod ready

* skip deploy test when no DOCKER_USERNAME and DOCKER_PASSWORD found
  • Loading branch information
metrue authored Oct 14, 2019
1 parent 81e18e5 commit c9d382d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions deploy/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import (
"testing"
)

func TestK8SRunner(t *testing.T) {
func TestK8SDeployer(t *testing.T) {
workdir := "./fixture"
name := "hello"
ports := []int32{32300}
kubeconfig := os.Getenv("KUBECONFIG")
if kubeconfig == "" {
t.Skip("skip test since no KUBECONFIG given in environment variable")
username := os.Getenv("DOCKER_USERNAME")
password := os.Getenv("DOCKER_PASSWORD")
if kubeconfig == "" || username == "" || password == "" {
t.Skip("skip test since no KUBECONFIG, DOCKER_USERNAME and DOCKER_PASSWORD given in environment variable")
}
k8s, err := Create()
if err != nil {
Expand Down
10 changes: 7 additions & 3 deletions scripts/test_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ run() {
deploy() {
local lang=$1
local port=$2
$fx deploy --name ${service}_${lang} --port ${port} test/functions/func.${lang}
docker ps
$fx destroy ${service}_${lang}
if [[ -z "$DOCKER_USERNAME" || -z "$DOCKER_PASSWORD" ]];then
echo "skip deploy test since no DOCKER_USERNAME and DOCKER_PASSWORD set"
else
$fx deploy --name ${service}_${lang} --port ${port} test/functions/func.${lang}
docker ps
$fx destroy ${service}_${lang}
fi
}

build_image() {
Expand Down

0 comments on commit c9d382d

Please sign in to comment.