How to run e2e tests on custom cluster within Kubernetes. - kubernetes

https://github.com/kubernetes/community/blob/master/contributors/devel/e2e-tests.md#testing-against-local-clusters
I have been following the above guide, but I keep getting this error:
2017/07/12 09:53:58 util.go:131: Step './cluster/kubectl.sh version --match-server-version=false' finished in 20.604745ms
2017/07/12 09:53:58 util.go:129: Running: ./hack/e2e-internal/e2e-status.sh
WARNING: The bash deployment for AWS is obsolete. The
v1.5.x releases are the last to support cluster/kube-up.sh with AWS.
For a list of viable alternatives, (...)
2017/07/12 09:53:58 util.go:131: Step './hack/e2e-internal/e2e-status.sh' finished in 18.71843ms
2017/07/12 09:53:58 main.go:216: Something went wrong: encountered 2 errors: [error during ./cluster/kubectl.sh version --match-server-version=false: exit status 1 error during ./hack/e2e-internal/e2e-status.sh: exit status 1]
2017/07/12 09:53:58 e2e.go:78: err: exit status 1
How do I fix this, what am I doing wrong?

If you just want to execute e2e tests without setting up the whole cluster, you can compile them from kubernetes repository: make all WHAT=test/e2e/e2e.test, and then run this compiled e2e binary against your cluster: ./e2e.test --host="<your apiserver>" --provider=local --kubeconfig=<kubeconfig location> -ginkgo.Focus="/[Conformance/]". Conformance tests should pass for any kubernetes cluster, but of course you can set any filter you want. To list all available tests, type: ./e2e.test --ginkgo.DryRun.

Some supplements
You can also compile ginkgo:
make WHAT=vendor/github.com/onsi/ginkgo/ginkgo
Some options are useful:(ginkgo --help to see details)
-flakeAttempts
-focus
-nodes
-outputdir
-skip
-v
To run tests parellely:(set --node=1 for serial tests)
./_output/bin/ginkgo --nodes=25 --flakeAttempts=2 \
./_output/bin/e2e.test -- --host="http://127.0.0.1:8080" \
--provider="local" --ginkgo.v=true --kubeconfig="~/.kube/config" \
--ginkgo.focus="Conformance" --ginkgo.skip="Serial|Slow" \
--ginkgo.failFast=false
And if you want to launch local cluster for e2e testing, hack/local-up-cluster.sh is handy.

Related

Github Action failing to Build Images for the plugins being used in workflow

I am trying to use a plugin in my eks based k8s cluster,
I am using a Github Action controller that spawns on demand Container as Self Hosted runner
When the Github action start this plugin or any other that needs to build itself as a docker image fails with below error, any thoughts or ideas ?
This is my self hosted runner image Link
FYI : If i run a standalone alpine container in the cluster all typical cmd works, and this also works with default ubuntu based self hosted runner, so i dont think its the cluster
/usr/local/bin/docker build -t 60e226:1b6fc15462134e6fb8520b7df48cf7fd -f "/runner/_work/_actions/aquasecurity/trivy-action/master/Dockerfile" "/runner/_work/_actions/aquasecurity/trivy-action/master"
Sending build context to Docker daemon 644.6kB
Step 1/5 : FROM ghcr.io/aquasecurity/trivy:0.[3](https://github.com//docker-images/actions/runs/4134005760/jobs/7147011143#step:3:3)7.1
0.37.1: Pulling from aquasecurity/trivy
c158987b0551: Pulling fs layer
67a7d067ef7d: Pulling fs layer[6]Download complete
67a7d067ef7d: Pull complete
2ec1cdd48f38: Verifying Checksum
2ec1cdd48f38: Download complete
2ec1cdd48f38: Pull complete
fe56e6aa700e: Pull complete
Digest: sha256:7c[16](https://github.com//docker-images/actions/runs/4134005760/jobs/7147011143#step:3:16)7f7f3002948f1ec099555aa968bd8b8b097780603a38cc801fe965da0a69
Status: Downloaded newer image for ghcr.io/aquasecurity/trivy:0.37.1
---> c3e68408cd24
Step 2/5 : COPY entrypoint.sh /
---> 1f1da443ea86
Step 3/5 : RUN apk --no-cache add bash curl npm
---> Running in 647f7f479cac
fetch https://dl-cdn.alpinelinux.org/alpine/v3.[17](https://github.com//docker-images/actions/runs/4134005760/jobs/7147011143#step:3:17)/main/x86_64/APKINDEX.tar.gz
48ABC73BEB7F0000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:[18](https://github.com//docker-images/actions/runs/4134005760/jobs/7147011143#step:3:18)89:
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/main: Permission denied
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
48ABC73BEB7F0000:error:0A000086:SSL routines:tls_post_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1889:
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.17/community: Permission denied
ERROR: unable to select packages:
bash (no such package):
required by: world[bash]
curl (no such package):
required by: world[curl]
npm (no such package):
required by: world[npm]
The command '/bin/sh -c apk --no-cache add bash curl npm' returned a non-zero code: 3
Warning: Docker build failed with exit code 3, back off 6.807 seconds before retry.
It was expected to build the docker image and proceed with the github action workflow
Tried different flavors of image and nothing worked except for ubunut-latest
the plugin in question
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action#master
with:
image-ref: 'test:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'

Failures when running Keycloak Testsuite with external Keycloak server

I am trying to run the keycloak Testsuite against an external Keycloak server that I have created.
I am using the base tests in the integration-arquillian using the following commands
mvn -f testsuite/integration-arquillian/tests/base/pom.xml clean install --log-file My_testsuite_integration_logs06.txt -Pauth-server-wildfly -Dauth.server.ssl.required=false -Dpageload.timeout=3600000 -Dauth.server.host={my-server-details} -Dauth.server.http.port={port#}
It works when I am using the embedded tests, but when I add the server details as stated in the HOW-TO-RUN.md file its failing.
https://github.com/keycloak/keycloak/tree/stage/testsuite/integration-arquillian
========
[INFO] Running org.keycloak.testsuite.account.AccountFormServiceTest
11:56:38,313 ERROR [org.keycloak.testsuite.account.AccountFormServiceTest] [AccountFormServiceTest] null() FAILED
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.003 s <<< FAILURE! - in org.keycloak.testsuite.account.AccountFormServiceTest
[ERROR] org.keycloak.testsuite.account.AccountFormServiceTest Time elapsed: 0.003 s <<< ERROR!
java.lang.RuntimeException: Arquillian initialization has already been attempted, but failed. See previous exceptions for cause
at org.jboss.arquillian.junit.AdaptorManagerWithNotifier.handleSuiteLevelFailure(AdaptorManagerWithNotifier.java:36)
at org.jboss.arquillian.junit.AdaptorManager.initializeAdaptor(AdaptorManager.java:16)
at org.jboss.arquillian.junit.AdaptorManagerWithNotifier.initializeAdaptor(AdaptorManagerWithNotifier.java:19)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:109)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: The java process starting the managed server exited unexpectedly with code [2]
at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:152)
at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:123)
...
==
Getting similiar to above for all my tests and not sure why it is failing.
any help be great.
Your description of the issue is quiet vague, but have you tried
mvn -f testsuite/integration-arquillian/tests/base/pom.xml clean install -Pauth-server-remote -Dauth.server.ssl.required=false Dpageload.timeout=3600000 -Dauth.server.host={my-server-details} -Dauth.server.http.port={port#}
The Profile defined could be where the issue lies.
If you take a look at the documentation https://github.com/keycloak/keycloak/blob/stage/testsuite/integration-arquillian/HOW-TO-RUN.md#remote-server-tests
It shows you how to build the keycloak server from source and run it (remote or local) and the above command is then used to run tests against this solution. Take note of
"The testsuite currently doesn't work with port 80."

Codeship Pro on_fail accross step

Is the on_fail directive of a step run when a previous step has failed ?
I'm using these steps :
- name: fail intentionally
service: busybox
command: false
- name: check if onfail is called
service: busybox
command: true
on_fail:
- command: echo reporting failure
Calling jet steps produces the following output :
(step: fail intentionally)
(image: busybox) (service: busybox) Image exists, using cached image
(step: fail intentionally) error ✗
(step: fail intentionally) container exited with a 1 code
My on_fail is not run.
Is that an issue with the jet utility or would things behave the same in Codeship ?
You have defined an on_fail contingency for the second test step (a step that will not fail). If the on_fail was set for the first step (which fails and stops the build), you would have noted the echoed statement.
This behavior would be consistent with a build running in CodeShip Pro.

Golang dep unable to resolve dependencies

I am using kubebuilder to create kubernetes operator project. After running the project init command described in quickstart guide
kubebuilder init --domain k8s.io --license apache2 --owner "The Kubernetes Authors"
dep ensure returns with error log given below.
Solving failure: No versions of k8s.io/client-go met constraints:
v8.0.0: Could not introduce k8s.io/client-go#v8.0.0, as it is not allowed by constraints from the following projects:
kubernetes-1.10.1 from (root)
kubernetes-1.10.1 from sigs.k8s.io/controller-runtime#master
v7.0.0: Could not introduce k8s.io/client-go#v7.0.0, as it is not allowed by constraints from the following projects:
kubernetes-1.10.1 from (root)
kubernetes-1.10.1 from sigs.k8s.io/controller-runtime#master
v6.0.0: Could not introduce k8s.io/client-go#v6.0.0, as it is not allowed by constraints from the following projects:
kubernetes-1.10.1 from (root)
kubernetes-1.10.1 from sigs.k8s.io/controller-runtime#master
Try using the latest kubebuilder from here. It's likely that the dependencies for the version in the quick start are out of date.
It works fine for me with v1.0.3
~/go/src/github.com $ kubebuilder init --domain k8s.io --license apache2 --owner "The Kubernetes Authors"
Run `dep ensure` to fetch dependencies (Recommended) [y/n]?
y
dep ensure
Running make...
make
go generate ./pkg/... ./cmd/...
go fmt ./pkg/... ./cmd/...
go vet ./pkg/... ./cmd/...
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go all
CRD manifests generated under '/root/go/src/github.com/config/crds'
RBAC manifests generated under '/root/go/src/github.com/config/rbac'
go test ./pkg/... ./cmd/... -coverprofile cover.out
? github.com/pkg/apis [no test files]
? github.com/pkg/controller [no test files]
ok github.com/pkg/errors 0.207s coverage: 100.0% of statements
? github.com/cmd/manager [no test files]
go build -o bin/manager github.com/cmd/manager
Next: Define a resource with:
$ kubebuilder create api

Does "Placing binaries" mean building k8s successfully?

I follow this Getting started with Kubernetes on Mesos to try to build Kubernetes-Mesos:
git clone https://github.com/kubernetes/kubernetes
cd kubernetes
export KUBERNETES_CONTRIB=mesos
make
But executing make, it outputs following log:
$ make
hack/build-go.sh
+++ [1204 04:38:23] Building go targets for linux/amd64:
cmd/kube-proxy
cmd/kube-apiserver
cmd/kube-controller-manager
cmd/kubelet
cmd/kubemark
cmd/hyperkube
cmd/linkcheck
plugin/cmd/kube-scheduler
contrib/mesos/cmd/k8sm-scheduler
contrib/mesos/cmd/k8sm-executor
contrib/mesos/cmd/k8sm-controller-manager
contrib/mesos/cmd/km
cmd/kubectl
cmd/integration
cmd/gendocs
cmd/genkubedocs
cmd/genman
cmd/mungedocs
cmd/genbashcomp
cmd/genconversion
cmd/gendeepcopy
cmd/genswaggertypedocs
examples/k8petstore/web-server/src
github.com/onsi/ginkgo/ginkgo
test/e2e/e2e.test
+++ [1204 04:38:34] Placing binaries
$
So is the build success or not? I can't find useful prompt info.
Yes, that indicates a successful build.