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

Introduce Testbed #51

Merged
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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ BUILD_INFO=-ldflags "${BUILD_X1} ${BUILD_X2}"
.PHONY: all
all: common otelcontribcol

.PHONY: e2e-test
e2e-test: otelcontribcol
$(MAKE) -C testbed runtests

.PHONY: ci
ci: all test-with-cover

Expand Down
9 changes: 9 additions & 0 deletions testbed/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include ../Makefile.Common

.PHONY: runtests
runtests: test
./runtests.sh

.PHONY: install-tools
install-tools:
go install github.com/jstemmer/go-junit-report
9 changes: 9 additions & 0 deletions testbed/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/open-telemetry/opentelemetry-collector-contrib/testbed

go 1.12

require (
github.com/open-telemetry/opentelemetry-collector v0.2.1-0.20191209163440-5d463fe48816
github.com/open-telemetry/opentelemetry-collector/testbed v0.0.0-20191209163440-5d463fe48816
github.com/stretchr/testify v1.4.0
)
710 changes: 710 additions & 0 deletions testbed/go.sum

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions testbed/runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

cd tests

SED="sed"

PASS_COLOR=$(printf "\033[32mPASS\033[0m")
FAIL_COLOR=$(printf "\033[31mFAIL\033[0m")
TEST_COLORIZE="${SED} 's/PASS/${PASS_COLOR}/' | ${SED} 's/FAIL/${FAIL_COLOR}/'"

TESTBED_CONFIG=local.yaml go test -v 2>&1 | tee results/testoutput.log | bash -c "${TEST_COLORIZE}"

testStatus=${PIPESTATUS[0]}

mkdir -p results/junit
go-junit-report < results/testoutput.log > results/junit/results.xml

bash -c "cat results/TESTRESULTS.md | ${TEST_COLORIZE}"

exit ${testStatus}
2 changes: 2 additions & 0 deletions testbed/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
results/*
!results/BASELINE.md
1 change: 1 addition & 0 deletions testbed/tests/local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
agent: ../../bin/{{.GOOS}}/otelcontribcol
46 changes: 46 additions & 0 deletions testbed/tests/perf_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2019, OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package tests contains test cases. To run the tests go to tests directory and run:
// TESTBED_CONFIG=local.yaml go test -v

package tests

import (
"testing"

"github.com/open-telemetry/opentelemetry-collector/testbed/testbed"
scenarios "github.com/open-telemetry/opentelemetry-collector/testbed/tests"
"github.com/open-telemetry/opentelemetry-collector/testutils"
)

// TestMain is used to initiate setup, execution and tear down of testbed.
func TestMain(m *testing.M) {
testbed.DoTestMain(m)
}

func Test10kSPS(t *testing.T) {
tests := []struct {
name string
receiver testbed.Receiver
}{
{"JaegerRx", testbed.NewJaegerReceiver(int(testutils.GetAvailablePort(t)))},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
scenarios.Scenario10kSPS(t, testbed.NewJaegerExporter(int(testutils.GetAvailablePort(t))), test.receiver)
})
}
}
8 changes: 8 additions & 0 deletions testbed/tests/results/BASELINE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Test Results
Started: Mon, 09 Dec 2019 12:08:37 -0500

Test |Result|Duration|CPU Avg%|CPU Max%|RAM Avg MiB|RAM Max MiB|Sent Spans|Received Spans
----------------------------------------|------|-------:|-------:|-------:|----------:|----------:|---------:|-------------:
Test10kSPS/JaegerRx |PASS | 15s| 44.9| 49.5| 21| 26| 150020| 150020

Total duration: 15s