Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Oct 5, 2023
1 parent 813c9ef commit 5022d5c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
- name: Fix kubelet TLS server certificates
run: |
kubectl get csr -o=jsonpath='{range.items[?(@.spec.signerName=="kubernetes.io/kubelet-serving")]}{.metadata.name}{" "}{end}' | xargs kubectl certificate approve
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: nodejs_test
path: /tmp
- name: Build Node.js docker image
run: |
cd e2e_tests/testdata/nodejs
Expand Down
24 changes: 23 additions & 1 deletion e2e_tests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ const testKubeConfig = "/tmp/kube-config-splunk-otel-collector-chart-e2e-testing
// TestTracesReception tests the chart with a real k8s cluster.
// Run the following command prior to running the test locally:
//
// kind create cluster --kubeconfig=/tmp/kube-config-splunk-otel-collector-chart-e2e-testing
// kind create cluster --kubeconfig=/tmp/kube-config-splunk-otel-collector-chart-e2e-testing
// cd e2e_tests/testdata/nodejs
// docker build -t nodejs_test:latest .
// kind load docker-image nodejs_test:latest --name kind
func TestTracesReception(t *testing.T) {
// cannot patch "sock-splunk-otel-collector" with kind Instrumentation: Internal error occurred: failed calling webhook "minstrumentation.kb.io": failed to call webhook: Post "https://sock-operator-webhook.default.svc:443/mutate-opentelemetry-io-v1alpha1-instrumentation?timeout=10s": dial tcp 10.96.245.118:443: connect: connection refused
t.Skip("Issue with deploying the operator on kind, skipping")
Expand Down Expand Up @@ -263,6 +266,25 @@ func waitForMetrics(t *testing.T, entriesNum int, mc *consumertest.MetricsSink)
"failed to receive %d entries, received %d metrics in %d minutes", entriesNum,
len(mc.AllMetrics()), timeoutMinutes)
}

func waitForLogs(t *testing.T, entriesNum int, lc *consumertest.LogsSink) {
f := otlpreceiver.NewFactory()
cfg := f.CreateDefaultConfig().(*otlpreceiver.Config)

rcvr, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, lc)
require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost()))
require.NoError(t, err, "failed creating logs receiver")
defer func() {
assert.NoError(t, rcvr.Shutdown(context.Background()))
}()

timeoutMinutes := 3
require.Eventuallyf(t, func() bool {
return len(lc.AllLogs()) > entriesNum
}, time.Duration(timeoutMinutes)*time.Minute, 1*time.Second,
"failed to receive %d entries, received %d logs in %d minutes", entriesNum,
len(lc.AllLogs()), timeoutMinutes)
}
func hostEndpoint(t *testing.T) string {
if runtime.GOOS == "darwin" {
return "host.docker.internal"
Expand Down

0 comments on commit 5022d5c

Please sign in to comment.