Skip to content

Commit

Permalink
[chore] try out macos-14 to run arm tests (#33921)
Browse files Browse the repository at this point in the history
As documented in this blog post
https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/

The actuated runner has been causing build failures pretty consistently
on main. Possibly fix the following flaky tests:

Fixes
#32391
Fixes
#32395
Fixes
#32839

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten authored Aug 7, 2024
1 parent 176f514 commit 6a41efc
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
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

0 comments on commit 6a41efc

Please sign in to comment.