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] try out macos-14 to run arm tests #33921

Merged
merged 6 commits into from
Aug 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
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ env:
# Make sure to exit early if cache segment download times out after 2 minutes.
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
GOPROXY: https://goproxy1.cncf.selfactuated.dev,direct

# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616
concurrency:
Expand All @@ -27,6 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [otel-linux-arm64, macos-14]
group:
- receiver-0
- receiver-1
Expand All @@ -46,7 +46,7 @@ jobs:
- cmd-1
- other
timeout-minutes: 30
runs-on: actuated-arm64-4cpu-4gb
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -72,7 +72,7 @@ jobs:
run: make -j2 gotest GROUP=${{ matrix.group }}
arm-unittest:
if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run ARM') || github.event_name == 'push' || github.event_name == 'merge_group') }}
runs-on: actuated-arm64-4cpu-4gb
runs-on: ubuntu-latest
needs: [arm-unittest-matrix]
steps:
- name: Print result
Expand Down
5 changes: 3 additions & 2 deletions extension/bearertokenauthextension/bearertokenauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"net/http"
"os"
"path/filepath"
"testing"
"time"

Expand Down Expand Up @@ -102,7 +103,7 @@ func TestBearerAuthenticator(t *testing.T) {

func TestBearerStartWatchStop(t *testing.T) {
cfg := createDefaultConfig().(*Config)
cfg.Filename = "test.token"
cfg.Filename = filepath.Join("testdata", t.Name()+".token")

bauth := newBearerTokenAuth(cfg, zaptest.NewLogger(t))
assert.NotNil(t, bauth)
Expand Down Expand Up @@ -152,7 +153,7 @@ func TestBearerStartWatchStop(t *testing.T) {
func TestBearerTokenFileContentUpdate(t *testing.T) {
scheme := "TestScheme"
cfg := createDefaultConfig().(*Config)
cfg.Filename = "test.token"
cfg.Filename = filepath.Join("testdata", t.Name()+".token")
cfg.Scheme = scheme

bauth := newBearerTokenAuth(cfg, zaptest.NewLogger(t))
Expand Down
1 change: 0 additions & 1 deletion extension/bearertokenauthextension/test.token

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...+file+
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...+file
16 changes: 7 additions & 9 deletions receiver/hostmetricsreceiver/hostmetrics_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/processscraper"
)

var armMetrics = []string{
var allMetrics = []string{
"system.cpu.time",
"system.cpu.load_average.1m",
"system.cpu.load_average.5m",
Expand All @@ -56,11 +56,6 @@ var armMetrics = []string{
"system.paging.operations",
}

var archSpecificMetrics = map[string][]string{
"arm64": armMetrics,
"amd64": append(armMetrics, "system.paging.usage"),
}

var resourceMetrics = []string{
"process.cpu.time",
"process.memory.usage",
Expand Down Expand Up @@ -172,9 +167,12 @@ func assertIncludesExpectedMetrics(t *testing.T, got pmetric.Metrics) {
}
}

// verify the expected list of metrics returned (os dependent)
var expectedMetrics []string
expectedMetrics = append(expectedMetrics, archSpecificMetrics[runtime.GOARCH]...)
// verify the expected list of metrics returned (os/arch dependent)
expectedMetrics := allMetrics
if !(runtime.GOOS == "linux" && runtime.GOARCH == "arm64") {
expectedMetrics = append(expectedMetrics, "system.paging.usage")
}

expectedMetrics = append(expectedMetrics, systemSpecificMetrics[runtime.GOOS]...)
assert.Equal(t, len(expectedMetrics), len(returnedMetrics))
for _, expected := range expectedMetrics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ func TestScrape(t *testing.T) {
if runtime.GOOS == "windows" {
expectedMetrics = 3
}
// ARM runner has no swap:
if runtime.GOARCH == "arm64" {

// linux + ARM runner has no swap
if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
expectedMetrics = 2
}

Expand All @@ -100,7 +101,8 @@ func TestScrape(t *testing.T) {

internal.AssertSameTimeStampForMetrics(t, metrics, 0, metrics.Len()-2)
startIndex++
if runtime.GOARCH != "arm64" {

if !(runtime.GOOS == "linux" && runtime.GOARCH == "arm64") {
assertPagingUsageMetricValid(t, metrics.At(startIndex))
internal.AssertSameTimeStampForMetrics(t, metrics, startIndex, metrics.Len())
startIndex++
Expand Down
Loading