Skip to content

Commit 75f6de7

Browse files
committed
Add buildOs to normal test case
1 parent e0110cb commit 75f6de7

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

internal/controller/manager.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package controller
33
import (
44
"context"
55
"fmt"
6-
"os"
76
"time"
87

98
"github.com/go-logr/logr"
@@ -291,7 +290,6 @@ func StartManager(cfg config.Config) error {
291290
Name: cfg.GatewayPodConfig.Name,
292291
},
293292
ImageSource: cfg.ImageSource,
294-
BuildOS: os.Getenv("BUILD_OS"),
295293
Flags: cfg.Flags,
296294
NginxOneConsoleConnection: cfg.NginxOneConsoleTelemetryConfig.DataplaneKeySecretName != "",
297295
})

internal/controller/telemetry/collector.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"os"
78
"runtime"
89
"sort"
910
"strings"
@@ -178,6 +179,11 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
178179

179180
nginxPodCount := getNginxPodCount(g, clusterInfo.NodeCount)
180181

182+
buildOs := os.Getenv("BUILD_OS")
183+
if buildOs == "" {
184+
buildOs = "alpine"
185+
}
186+
181187
data := Data{
182188
Data: tel.Data{
183189
ProjectName: "NGF",
@@ -191,7 +197,7 @@ func (c DataCollectorImpl) Collect(ctx context.Context) (Data, error) {
191197
},
192198
NGFResourceCounts: graphResourceCount,
193199
ImageSource: c.cfg.ImageSource,
194-
BuildOS: c.cfg.BuildOS,
200+
BuildOS: buildOs,
195201
FlagNames: c.cfg.Flags.Names,
196202
FlagValues: c.cfg.Flags.Values,
197203
SnippetsFiltersDirectives: snippetsFiltersDirectives,

internal/controller/telemetry/collector_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ var _ = Describe("Collector", Ordered, func() {
172172
NGFResourceCounts: telemetry.NGFResourceCounts{},
173173
ControlPlanePodCount: 1,
174174
ImageSource: "local",
175-
BuildOS: "ubi",
175+
BuildOS: "alpine",
176176
FlagNames: flags.Names,
177177
FlagValues: flags.Values,
178178
SnippetsFiltersDirectives: []string{},
@@ -194,7 +194,7 @@ var _ = Describe("Collector", Ordered, func() {
194194
Version: version,
195195
PodNSName: podNSName,
196196
ImageSource: "local",
197-
BuildOS: "ubi",
197+
BuildOS: "alpine",
198198
Flags: flags,
199199
NginxOneConsoleConnection: true,
200200
})
@@ -521,6 +521,7 @@ var _ = Describe("Collector", Ordered, func() {
521521
expData.NginxPodCount = int64(8)
522522
expData.ControlPlanePodCount = int64(2)
523523
expData.NginxOneConnectionEnabled = true
524+
expData.BuildOS = "alpine"
524525

525526
data, err := dataCollector.Collect(ctx)
526527
Expect(err).ToNot(HaveOccurred())

0 commit comments

Comments
 (0)