-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Golang E2E in Openshift API-CI (#1384)
* *: reworking for openshift-ci * test/e2e/_incluster-test-code/memcached_test.go: don't use parallel tests Travis still doesn't like running these tests in parallel, so keep them sequential until we fully migrate to api-ci * scaffold,pkg/{metrics,leader,k8sutil}: add force local mode * cmd/.../{test,up}/local: set env var for commands
- Loading branch information
1 parent
f4dd3b1
commit 1ee9386
Showing
13 changed files
with
105 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM osdk-builder as builder | ||
|
||
RUN ci/tests/e2e-go-scaffold.sh | ||
|
||
FROM registry.access.redhat.com/ubi7/ubi-minimal:latest | ||
|
||
ENV OPERATOR=/usr/local/bin/memcached-operator \ | ||
USER_UID=1001 \ | ||
USER_NAME=memcached-operator | ||
|
||
# install operator binary | ||
COPY --from=builder /memcached-operator ${OPERATOR} | ||
COPY test/test-framework/build/bin /usr/local/bin | ||
|
||
RUN /usr/local/bin/user_setup | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint"] | ||
|
||
USER ${USER_UID} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
# Scaffold project (image name and local image args don't matter at this stage as those only affect the operator manifest) | ||
source ./hack/tests/scaffolding/e2e-go-scaffold.sh | ||
|
||
pushd $BASEPROJECTDIR/memcached-operator | ||
go build -gcflags "all=-trimpath=${GOPATH}" -asmflags "all=-trimpath=${GOPATH}" -o /memcached-operator $BASEPROJECTDIR/memcached-operator/cmd/manager | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
make install | ||
# this configures the image correctly for memcached-operator | ||
component="memcached-operator" | ||
eval IMAGE=$IMAGE_FORMAT | ||
set -- "--image-name=$IMAGE --local-image=false" | ||
source ./hack/tests/scaffolding/e2e-go-scaffold.sh | ||
|
||
pushd $BASEPROJECTDIR/memcached-operator | ||
operator-sdk test local ./test/e2e | ||
popd | ||
|
||
go test ./test/e2e/... -root=. -globalMan=testdata/empty.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh -e | ||
|
||
# This is documented here: | ||
# https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines | ||
|
||
if ! whoami &>/dev/null; then | ||
if [ -w /etc/passwd ]; then | ||
echo "${USER_NAME:-memcached-operator}:x:$(id -u):$(id -g):${USER_NAME:-memcached-operator} user:${HOME}:/sbin/nologin" >> /etc/passwd | ||
fi | ||
fi | ||
|
||
exec ${OPERATOR} $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
set -x | ||
|
||
# ensure $HOME exists and is accessible by group 0 (we don't know what the runtime UID will be) | ||
mkdir -p ${HOME} | ||
chown ${USER_UID}:0 ${HOME} | ||
chmod ug+rwx ${HOME} | ||
|
||
# runtime user will need to be able to self-insert in /etc/passwd | ||
chmod g+rw /etc/passwd | ||
|
||
# no need for this script to remain in the image after running | ||
rm $0 |