Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cache test to not rely on current context #1787

Closed
tejal29 opened this issue Mar 12, 2019 · 0 comments
Closed

Fix cache test to not rely on current context #1787

tejal29 opened this issue Mar 12, 2019 · 0 comments

Comments

@tejal29
Copy link
Member

tejal29 commented Mar 12, 2019

Skaffold Build Cache tests github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/cache fails on master at or above b0f4b03 if kubeconfig context is set to minikube.

Expected behavior

go test ./... should pass irrespective of what the current context is set to in user's development environment

Actual behavior

tejaldesai@tejaldesai~/go/src/github.com/GoogleContainerTools/skaffold: (master)$ kubectl config use-context minikube
Switched to context "minikube".
tejaldesai@tejaldesai~/go/src/github.com/GoogleContainerTools/skaffold: (master)$ kubectl config current-context
minikube

tejaldesai@tejaldesai~/go/src/github.com/GoogleContainerTools/skaffold: (master)$ go clean --testcache
tejaldesai@tejaldesai~/go/src/github.com/GoogleContainerTools/skaffold: (master)$ go test -v github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/cache -run ^Test_NewCache
=== RUN   Test_NewCache
=== RUN   Test_NewCache/get_a_valid_cache_from_file
time="2019-03-12T15:05:51-07:00" level=info msg="no config entry found for kube-context minikube"
=== RUN   Test_NewCache/needs_push
time="2019-03-12T15:05:51-07:00" level=info msg="no config entry found for kube-context minikube"
=== RUN   Test_NewCache/valid_cache_file_exists,_but_useCache_is_false
=== RUN   Test_NewCache/corrupted_cache_file
time="2019-03-12T15:05:51-07:00" level=warning msg="Error retrieving artifact cache, not using skaffold cache: yaml: unmarshal errors:\n  line 1: cannot unmarshal !!str `corrupt...` into cache.ArtifactCache"
--- FAIL: Test_NewCache (0.00s)
    --- FAIL: Test_NewCache/get_a_valid_cache_from_file (0.00s)
        cache_test.go:148: Expected result different from actual result. Expected: &{map[hash:{digest id}] 0xc00028c0a0 <nil> [{0 0 image map[]  [] [] 0 0 0}] /tmp/827158023 true false false}, Actual: &{map[hash:{digest id}] 0xc00028c140 <nil> [{0 0 image map[]  [] [] 0 0 0}] /tmp/827158023 true false true}
    --- FAIL: Test_NewCache/needs_push (0.00s)
        cache_test.go:148: Expected result different from actual result. Expected: &{map[hash:{digest id}] 0xc0000caf50 <nil> [] /tmp/649495994 true true false}, Actual: &{map[hash:{digest id}] 0xc0000cafa0 <nil> [] /tmp/649495994 true true true}
    --- PASS: Test_NewCache/valid_cache_file_exists,_but_useCache_is_false (0.00s)
    --- PASS: Test_NewCache/corrupted_cache_file (0.00s)
FAIL
FAIL	github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/cache	0.117s
tejaldesai@tejaldesai~/go/src/github.com/GoogleContainerTools/skaffold: (master)$ 

Information

  • Skaffold version: skaffold @ b0f4b03
  • Operating system: ...
  • Contents of skaffold.yaml:
<paste your skaffold.yaml here>

Steps to reproduce the behavior

  1. set kubecontext to minikube.
  2. run go clean --testcache
  3. run go test -v github.com/GoogleContainerTools/skaffold/pkg/skaffold/build/cache -run ^Test_NewCache
dgageot added a commit to dgageot/skaffold that referenced this issue Mar 13, 2019
dgageot added a commit to dgageot/skaffold that referenced this issue Mar 13, 2019
dgageot added a commit to dgageot/skaffold that referenced this issue Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant