Skip to content

Commit

Permalink
Fix nil bug when using sync.once (#23002)
Browse files Browse the repository at this point in the history
[APM Onboarding] SSI bug fix for 7.52.0
  • Loading branch information
liliyadd authored Feb 21, 2024
1 parent 2c40962 commit bbe80bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/clusteragent/admission/mutate/auto_instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type language string

type pinnedLibraries struct {
libraries []libInfo
once *sync.Once
once sync.Once
}

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"strconv"
"strings"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -575,8 +574,7 @@ func TestExtractLibInfo(t *testing.T) {
}

// reset pinned libraries between test runs
pinnedLibs.once = new(sync.Once)
pinnedLibs.libraries = []libInfo{}
pinnedLibs = &pinnedLibraries{}

apmInstrumentation, err := newAPMInstrumentationWebhook()
require.NoError(t, err)
Expand Down Expand Up @@ -1848,8 +1846,7 @@ func TestInjectAutoInstrumentation(t *testing.T) {
fakeStoreWithDeployment(t, tt.langDetectionDeployments)

// reset pinned libraries between test runs
pinnedLibs.once = new(sync.Once)
pinnedLibs.libraries = []libInfo{}
pinnedLibs = &pinnedLibraries{}

apmInstrumentation, err := newAPMInstrumentationWebhook()
require.NoError(t, err)
Expand Down

0 comments on commit bbe80bc

Please sign in to comment.