Skip to content

Seeing this error while running the tests: "Error: failed to build test binary: (failed to exec []string{"go", "test", "./test/e2e/..."" #2014

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

Closed
pratikjagrut opened this issue Oct 4, 2019 · 7 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. triage/support Indicates an issue that is a support question.

Comments

@pratikjagrut
Copy link
Contributor

pratikjagrut commented Oct 4, 2019

Bug Report

What did you do?
Trying to run e2e from sample memcached-operator.
operator-sdk test local ./test/e2e --up-local --namespace=memcached

What did you expect to see?
Test pass.

What did you see instead? Under which circumstances?

INFO[0000] Testing operator locally.                    
time="2019-10-07T14:05:52+05:30" level=info msg="Started local operator"
--- FAIL: TestMemcached (1.17s)
    --- FAIL: TestMemcached/memcached-group (0.00s)
        --- FAIL: TestMemcached/memcached-group/Cluster (0.05s)
            memcached_test.go:100: Initialized cluster resources
            wait_util.go:48: Operator is running locally; skip waitForDeployment
            memcached_test.go:114: namespaces "memcached" not found
        --- FAIL: TestMemcached/memcached-group/Cluster2 (0.05s)
            memcached_test.go:100: Initialized cluster resources
            wait_util.go:48: Operator is running locally; skip waitForDeployment
            memcached_test.go:114: namespaces "memcached" not found
FAIL
time="2019-10-07T14:05:54+05:30" level=info msg="Local operator stdout: "
time="2019-10-07T14:05:54+05:30" level=info msg="Local operator stderr: {\"level\":\"info\",\"ts\":1570437352.8765619,\"logger\":\"cmd\",\"msg\":\"Go Version: go1.12.9\"}\n{\"level\":\"info\",\"ts\":1570437352.8765812,\"logger\":\"cmd\",\"msg\":\"Go OS/Arch: linux/amd64\"}\n{\"level\":\"info\",\"ts\":1570437352.8765836,\"logger\":\"cmd\",\"msg\":\"Version of operator-sdk: v0.10.0\"}\n{\"level\":\"info\",\"ts\":1570437352.8781104,\"logger\":\"leader\",\"msg\":\"Trying to become the leader.\"}\n{\"level\":\"info\",\"ts\":1570437352.8781316,\"logger\":\"leader\",\"msg\":\"Skipping leader election; not running in a cluster.\"}\n{\"level\":\"info\",\"ts\":1570437352.9071925,\"logger\":\"cmd\",\"msg\":\"Registering Components.\"}\n{\"level\":\"info\",\"ts\":1570437352.9073122,\"logger\":\"kubebuilder.controller\",\"msg\":\"Starting EventSource\",\"controller\":\"memcached-controller\",\"source\":\"kind source: /, Kind=\"}\n{\"level\":\"info\",\"ts\":1570437352.907409,\"logger\":\"kubebuilder.controller\",\"msg\":\"Starting EventSource\",\"controller\":\"memcached-controller\",\"source\":\"kind source: /, Kind=\"}\n{\"level\":\"info\",\"ts\":1570437352.907462,\"logger\":\"kubebuilder.controller\",\"msg\":\"Starting EventSource\",\"controller\":\"memcached-controller\",\"source\":\"kind source: /, Kind=\"}\n{\"level\":\"info\",\"ts\":1570437352.9075456,\"logger\":\"cmd\",\"msg\":\"Could not generate and serve custom resource metrics\",\"error\":\"operator run mode forced to local\"}\n{\"level\":\"info\",\"ts\":1570437352.9254067,\"logger\":\"cmd\",\"msg\":\"Could not create metrics Service\",\"error\":\"failed to initialize service object for metrics: OPERATOR_NAME must be set\"}\n{\"level\":\"info\",\"ts\":1570437352.931353,\"logger\":\"cmd\",\"msg\":\"Could not create ServiceMonitor object\",\"error\":\"no ServiceMonitor registered with the API\"}\n{\"level\":\"info\",\"ts\":1570437352.9313684,\"logger\":\"cmd\",\"msg\":\"Install prometheus-operator in your cluster to create ServiceMonitor objects\",\"error\":\"no ServiceMonitor registered with the API\"}\n{\"level\":\"info\",\"ts\":1570437352.9313715,\"logger\":\"cmd\",\"msg\":\"Starting the Cmd.\"}\n{\"level\":\"info\",\"ts\":1570437353.031689,\"logger\":\"kubebuilder.controller\",\"msg\":\"Starting Controller\",\"controller\":\"memcached-controller\"}\n{\"level\":\"info\",\"ts\":1570437353.131971,\"logger\":\"kubebuilder.controller\",\"msg\":\"Starting workers\",\"controller\":\"memcached-controller\",\"worker count\":1}\n"
FAIL	github.com/operator-framework/operator-sdk-samples/memcached-operator/test/e2e	1.562s
Error: failed to build test binary: (failed to exec []string{"go", "test", "./test/e2e/...", "-namespacedMan", "/tmp/empty.yaml426791602", "-globalMan", "/tmp/global-manifest.yaml369096297", "-root", "/home/pjagrut/go/src/github.com/operator-framework/operator-sdk-samples/memcached-operator", "-singleNamespace", "-parallel=1", "-localOperator"}: exit status 1)
Usage:
  operator-sdk test local <path to tests directory> [flags]

Flags:
      --debug                         Enable debug-level logging
      --global-manifest string        Path to manifest for Global resources (e.g. CRD manifests)
      --go-test-flags string          Additional flags to pass to go test
  -h, --help                          help for local
      --image string                  Use a different operator image from the one specified in the namespaced manifest
      --kubeconfig string             Kubeconfig path
      --local-operator-flags string   The flags that the operator needs (while using --up-local). Example: "--flag1 value1 --flag2=value2"
      --molecule-test-flags string    Additional flags to pass to molecule test
      --namespace string              If non-empty, single namespace to run tests in
      --namespaced-manifest string    Path to manifest for per-test, namespaced resources (e.g. RBAC and Operator manifest)
      --no-setup                      Disable test resource creation
      --up-local                      Enable running operator locally with go run instead of as an image in the cluster

Global Flags:
      --verbose   Enable verbose logging

Environment

  • operator-sdk version: "v0.10.0-72-gdc713e4d", commit: "dc713e4d78905ce67128680a7f823a95ba3db234", go version: "go1.12.9 linux/amd64"
  • go version: go1.12.9 linux/amd64
  • Kubernetes version information:
  • Kubernetes cluster kind:
Client Version: version.Info{Major:"1", Minor:"10+", GitVersion:"v1.10.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2018-12-06T15:15:06Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
  • Are you writing your operator in ansible, helm, or go? Go

Additional context
A similar issue was discussed and closed before #1830

@pratikjagrut
Copy link
Contributor Author

@camilamacedo86 I'm facing the same problem with my project too.

@camilamacedo86 camilamacedo86 added kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. labels Oct 4, 2019
@camilamacedo86
Copy link
Contributor

Hi @AlexNPavel could you give a hand here to us? I understand that he is using the sample.

@camilamacedo86 camilamacedo86 added triage/support Indicates an issue that is a support question. kind/bug Categorizes issue or PR as related to a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed kind/bug Categorizes issue or PR as related to a bug. triage/support Indicates an issue that is a support question. labels Oct 4, 2019
@pratikjagrut
Copy link
Contributor Author

pratikjagrut commented Oct 4, 2019

@camilamacedo86 and @AlexNPavel If I run go test ./test/e2e/... -namespacedMan /tmp/namespace-init.yaml -globalMan /tmp/cache_v1alpha1_memcached_crd.yaml -root $GOPATH/src/github.com/operator-framework/operator-sdk-samples/memcached-operator -v -parallel=2 -localOperator test is passing.

@camilamacedo86 camilamacedo86 added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Oct 4, 2019
@pratikjagrut
Copy link
Contributor Author

@camilamacedo86 My apologies, I didn't know that operator-sdk test local ./test/e2e --up-local --namespace=memcached this won't create ns namespace=memcached if not present and will fail the test due to not finding ns. So closing this issue.

@camilamacedo86
Copy link
Contributor

WYT about contribute with the doc and add an annotation over it here?

@pratikjagrut
Copy link
Contributor Author

WYT about contribute with the doc and add an annotation over it here?

Ok, I'll send a PR to update the doc!

@pratikjagrut
Copy link
Contributor Author

@camilamacedo86 Raised PR to update the doc: #2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. triage/support Indicates an issue that is a support question.
Projects
None yet
Development

No branches or pull requests

2 participants