Skip to content

Commit

Permalink
add check
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantanjunming committed Nov 18, 2024
1 parent 8016d4b commit b985d61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
16 changes: 0 additions & 16 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,3 @@ runs:
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add coralogix-charts-virtual https://cgx.jfrog.io/artifactory/coralogix-charts-virtual
- name: Get and set Kind Host Endpoint
shell: bash
run: |
if [[ "$(uname)" == "Darwin" ]]; then
HOSTENDPOINT="host.docker.internal"
else
HOSTENDPOINT=$(docker network inspect kind --format='{{range .IPAM.Config}}{{if .Gateway}}{{.Gateway}}{{end}}{{end}}')
if [[ -z "$HOSTENDPOINT" ]]; then
echo "Failed to find host endpoint" >&2
fi
fi
# Set the HOSTENDPOINT environment variable for GitHub Actions
echo "HOSTENDPOINT=$HOSTENDPOINT" >> $GITHUB_ENV
echo "HOSTENDPOINT is set to $HOSTENDPOINT"
15 changes: 14 additions & 1 deletion .github/workflows/otel-integration-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ jobs:
run: |
kubectl config view --raw > /tmp/kind-otel-integration-agent-e2e
echo "KUBECONFIG=/tmp/kind-otel-integration-agent-e2e" >> $GITHUB_ENV
- name: Get and set Kind Host Endpoint
shell: bash
run: |
if [[ "$(uname)" == "Darwin" ]]; then
HOSTENDPOINT="host.docker.internal"
else
HOSTENDPOINT=$(docker network inspect kind --format='{{range .IPAM.Config}}{{if .Gateway}}{{.Gateway}}{{end}}{{end}}')
if [[ -z "$HOSTENDPOINT" ]]; then
echo "Failed to find host endpoint" >&2
fi
fi
# Set the HOSTENDPOINT environment variable for GitHub Actions
echo "HOSTENDPOINT=$HOSTENDPOINT" >> $GITHUB_ENV
echo "HOSTENDPOINT is set to $HOSTENDPOINT"
- name: Setup Secret
run: kubectl create secret generic coralogix-keys --from-literal=PRIVATE_KEY=123
- name: Install chart & telemetrygen for testing
Expand All @@ -41,7 +55,6 @@ jobs:
-f ./values.yaml \
-f ./e2e-test/testdata/values-e2e-test.yaml
kubectl wait --all --for=condition=ready --timeout=300s pod -l component=agent-collector
kubectl get configmap coralogix-opentelemetry-agent -o yaml
- name: Run E2E test
env:
HOSTENDPOINT: ${{ env.HOSTENDPOINT }}
Expand Down
6 changes: 4 additions & 2 deletions otel-integration/k8s-helm/e2e-test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import (

func TestE2E_Agent(t *testing.T) {

//Print the HostEndpoint for debugging purposes
fmt.Println("HostEndpoint: " + k8stest.HostEndpoint(t))
//Check if the HOST_ENDPOINT is set
fmt.Println("Detected HostEndpoint: " + k8stest.HostEndpoint(t))
fmt.Println("Env HostEndpoint: " + os.Getenv("HOST_ENDPOINT"))
require.Equal(t, k8stest.HostEndpoint(t), os.Getenv("HOST_ENDPOINT"), "HostEndpoints does not match env and detected")

k8sDir := filepath.Join("k8s")

Expand Down

0 comments on commit b985d61

Please sign in to comment.