Skip to content

fix scripts to run in mac os x and or linux #2260

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

Merged
merged 2 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions doc/dev/testing/travis-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ The Go, Ansible, and Helm tests then differ in what tests they run.

**NOTE**: All created resources, including the namespace, are deleted using a bash trap when the test finishes

**NOTE** If you are using a MacOSX SO then will be required replace the sed command in the `hack/tests/e2e-ansible-molecule.sh` as the following example.

```sh
# Use the following sed command to check it on macOsX.
# More info: https://www.mkyong.com/mac/sed-command-hits-undefined-label-error-on-mac-os-x/
sed -i "" 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
# The following code is the default used (Not valid for MacOSX)
# sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
```

### Helm Tests

1. Run [helm e2e tests][helm-e2e].
Expand Down
2 changes: 1 addition & 1 deletion hack/generate/gen-test-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cd test/test-framework

# Ensure test-framework is up-to-date with current Go project dependencies.
echo "$(../../build/operator-sdk print-deps)" > go.mod
sed -i 's|github.com/operator-framework/operator-sdk\s\+master||g' go.mod
sed -i".bak" -E -e "s|github.com/operator-framework/operator-sdk[[:blank:]]+master||g" go.mod; rm -f go.mod.bak
echo -e "\nreplace github.com/operator-framework/operator-sdk => ../../" >> go.mod
go mod edit -require "github.com/operator-framework/[email protected]"
go build ./...
Expand Down
12 changes: 2 additions & 10 deletions hack/tests/e2e-ansible-molecule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ cat "$ROOTDIR/test/ansible-memcached/watches-v1-kind.yaml" >> memcached-operator

# Test local
pushd memcached-operator
# Use the following sed command to check it on macOsX.
# More info: https://www.mkyong.com/mac/sed-command-hits-undefined-label-error-on-mac-os-x/
# sed -i "" 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
# The following code is the default used (Not valid for MacOSX)
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
sed -i".bak" -E -e 's/(FROM quay.io\/operator-framework\/ansible-operator)(:.*)?/\1:dev/g' build/Dockerfile; rm -f build/Dockerfile.bak
OPERATORDIR="$(pwd)"
TEST_CLUSTER_PORT=24443 operator-sdk test local --namespace default

Expand All @@ -60,11 +56,7 @@ popd
popd

pushd "${ROOTDIR}/test/ansible-inventory"
# Use the following sed command to check it on macOsX.
# More info: https://www.mkyong.com/mac/sed-command-hits-undefined-label-error-on-mac-os-x/
# sed -i "" 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
# The following code is the default used (Not valid for MacOSX)
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
sed -i".bak" -E -e 's/(FROM quay.io\/operator-framework\/ansible-operator)(:.*)?/\1:dev/g' build/Dockerfile; rm -f build/Dockerfile.bak
TEST_CLUSTER_PORT=24443 operator-sdk test local --namespace default

popd
6 changes: 3 additions & 3 deletions hack/tests/e2e-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ cat "$ROOTDIR/test/ansible-memcached/watches-foo-kind.yaml" >> memcached-operato
pushd memcached-operator
# Add a second Kind to test watching multiple GVKs
operator-sdk add crd --kind=Foo --api-version=ansible.example.com/v1alpha1
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
sed -i".bak" -E -e 's/(FROM quay.io\/operator-framework\/ansible-operator)(:.*)?/\1:dev/g' build/Dockerfile; rm -f build/Dockerfile.bak
operator-sdk build "$DEST_IMAGE"
# If using a kind cluster, load the image into all nodes.
load_image_if_kind "$DEST_IMAGE"
sed -i "s|{{ REPLACE_IMAGE }}|$DEST_IMAGE|g" deploy/operator.yaml
sed -i 's|{{ pull_policy.default..Always.. }}|Never|g' deploy/operator.yaml
sed -i".bak" -E -e "s|\{\{ REPLACE_IMAGE \}\}|$DEST_IMAGE|g" deploy/operator.yaml; rm -f deploy/operator.yaml.bak
sed -i".bak" -E -e 's|\{\{ pull_policy.default..Always.. \}\}|Never|g' deploy/operator.yaml; rm -f deploy/operator.yaml.bak
# kind has an issue with certain image registries (ex. redhat's), so use a
# different test pod image.
METRICS_TEST_IMAGE="fedora:latest"
Expand Down
6 changes: 3 additions & 3 deletions hack/tests/e2e-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ if echo $log | grep -q "failed to generate RBAC rules"; then
fi

pushd nginx-operator
sed -i 's|\(FROM quay.io/operator-framework/helm-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
sed -i".bak" -E -e 's/(FROM quay.io\/operator-framework\/helm-operator)(:.*)?/\1:dev/g' build/Dockerfile; rm -f build/Dockerfile.bak
operator-sdk build "$DEST_IMAGE"
# If using a kind cluster, load the image into all nodes.
load_image_if_kind "$DEST_IMAGE"
sed -i "s|REPLACE_IMAGE|$DEST_IMAGE|g" deploy/operator.yaml
sed -i 's|Always|Never|g' deploy/operator.yaml
sed -i".bak" -E -e "s|REPLACE_IMAGE|$DEST_IMAGE|g" deploy/operator.yaml; rm -f deploy/operator.yaml.bak
sed -i".bak" -E -e 's|Always|Never|g' deploy/operator.yaml; rm -f deploy/operator.yaml.bak
# kind has an issue with certain image registries (ex. redhat's), so use a
# different test pod image.
METRICS_TEST_IMAGE="fedora:latest"
Expand Down