Skip to content

Commit a499c46

Browse files
fix scripts to run in mac os x and or linux (#2260)
* fix scripts to run in ios
1 parent 79f8564 commit a499c46

File tree

5 files changed

+9
-27
lines changed

5 files changed

+9
-27
lines changed

doc/dev/testing/travis-build.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ The Go, Ansible, and Helm tests then differ in what tests they run.
8383

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

86-
**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.
87-
88-
```sh
89-
# Use the following sed command to check it on macOsX.
90-
# More info: https://www.mkyong.com/mac/sed-command-hits-undefined-label-error-on-mac-os-x/
91-
sed -i "" 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
92-
# The following code is the default used (Not valid for MacOSX)
93-
# sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
94-
```
95-
9686
### Helm Tests
9787

9888
1. Run [helm e2e tests][helm-e2e].

hack/generate/gen-test-framework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cd test/test-framework
1313

1414
# Ensure test-framework is up-to-date with current Go project dependencies.
1515
echo "$(../../build/operator-sdk print-deps)" > go.mod
16-
sed -i 's|github.com/operator-framework/operator-sdk\s\+master||g' go.mod
16+
sed -i".bak" -E -e "s|github.com/operator-framework/operator-sdk[[:blank:]]+master||g" go.mod; rm -f go.mod.bak
1717
echo -e "\nreplace github.com/operator-framework/operator-sdk => ../../" >> go.mod
1818
go mod edit -require "github.com/operator-framework/[email protected]"
1919
go build ./...

hack/tests/e2e-ansible-molecule.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ cat "$ROOTDIR/test/ansible-memcached/watches-v1-kind.yaml" >> memcached-operator
4646

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

@@ -60,11 +56,7 @@ popd
6056
popd
6157

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

7062
popd

hack/tests/e2e-ansible.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ cat "$ROOTDIR/test/ansible-memcached/watches-foo-kind.yaml" >> memcached-operato
145145
pushd memcached-operator
146146
# Add a second Kind to test watching multiple GVKs
147147
operator-sdk add crd --kind=Foo --api-version=ansible.example.com/v1alpha1
148-
sed -i 's|\(FROM quay.io/operator-framework/ansible-operator\)\(:.*\)\?|\1:dev|g' build/Dockerfile
148+
sed -i".bak" -E -e 's/(FROM quay.io\/operator-framework\/ansible-operator)(:.*)?/\1:dev/g' build/Dockerfile; rm -f build/Dockerfile.bak
149149
operator-sdk build "$DEST_IMAGE"
150150
# If using a kind cluster, load the image into all nodes.
151151
load_image_if_kind "$DEST_IMAGE"
152-
sed -i "s|{{ REPLACE_IMAGE }}|$DEST_IMAGE|g" deploy/operator.yaml
153-
sed -i 's|{{ pull_policy.default..Always.. }}|Never|g' deploy/operator.yaml
152+
sed -i".bak" -E -e "s|\{\{ REPLACE_IMAGE \}\}|$DEST_IMAGE|g" deploy/operator.yaml; rm -f deploy/operator.yaml.bak
153+
sed -i".bak" -E -e 's|\{\{ pull_policy.default..Always.. \}\}|Never|g' deploy/operator.yaml; rm -f deploy/operator.yaml.bak
154154
# kind has an issue with certain image registries (ex. redhat's), so use a
155155
# different test pod image.
156156
METRICS_TEST_IMAGE="fedora:latest"

hack/tests/e2e-helm.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ if echo $log | grep -q "failed to generate RBAC rules"; then
125125
fi
126126

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

0 commit comments

Comments
 (0)