Skip to content
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

chore: update makefile and e2e script to handle macos #69

Merged
merged 1 commit into from
May 7, 2024
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
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ else
GOBIN=$(shell go env GOBIN)
endif

ifeq ($(go env GOOS),darwin)
TIMEOUT_CMD=gtimeout
else
TIMEOUT_CMD=timeout
endif


# CONTAINER_TOOL defines the container tool to be used for building images.
# Be aware that the target commands are only tested with Docker which is
# scaffolded by default. However, you might want to replace it to use other
Expand Down Expand Up @@ -212,7 +219,7 @@ tidy: ## Tidy Go modules

.PHONY: e2e-test
e2e-test: ## Run e2e tests
cd e2e && export CI_MODE=$(CI_MODE_ENABLED) NO_KIND_CLEANUP=$(NO_KIND_CLEANUP) && timeout --foreground 15m ./e2e_test.sh || (echo "E2E test failed"; exit 1)
cd e2e && export CI_MODE=$(CI_MODE_ENABLED) NO_KIND_CLEANUP=$(NO_KIND_CLEANUP) && $(TIMEOUT_CMD) --foreground 15m ./e2e_test.sh || (echo "E2E test failed"; exit 1)

.PHONY: e2e-test-ci
e2e-test-ci: CI_MODE_ENABLED=1
Expand Down
13 changes: 11 additions & 2 deletions e2e/e2e_test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/env bash
#!/usr/bin/env bash

set -eou pipefail

Expand All @@ -14,6 +14,15 @@ CI_MODE=${CI_MODE:-}
# Backup current kubernetes context
CURRENT_K8S_CTX=$(kubectl config view | grep "current" | cut -f 2 -d : | xargs)

if GOOS="darwin"
then
TIMEOUT_CMD=gtimeout
else
TIMEOUT_CMD=timeout
fi



# Prepare env
kind create cluster --name "${KIND_CLUSTER_NAME}" --wait 5m
kubectl config set-context kind-"${KIND_CLUSTER_NAME}"
Expand Down Expand Up @@ -41,7 +50,7 @@ kubectl wait --namespace opentelemetry-operator-system --for=condition=available
kubectl apply -f ../e2e/testdata/one_tenant_two_subscriptions

if [[ -z "${CI_MODE}" ]]; then
$(cd .. && timeout 5m make run &)
$(cd .. && $(TIMEOUT_CMD) 5m make run &)
else
kind load docker-image controller:latest --name "${KIND_CLUSTER_NAME}"
cd .. && make deploy && cd -
Expand Down
Loading