Skip to content

Commit f205edb

Browse files
authored
test with kind k8s v1.30 (#1341)
* test with kind k8s v1.30 * fix another fn * update tests for kind 1.30 * skip journald on 1-30 * fix version
1 parent 1251af9 commit f205edb

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.github/workflows/functional_test_v2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# The kubernetes_version matrix entries are currently following native Kubernetes version support and +1, see: https://endoflife.date/kubernetes
2121
# To check latest versions, see: https://hub.docker.com/r/kindest/node/tags
2222
k8s-version:
23-
# TODO: Add 1.30 support once Kind publishes an official 1.30 image
23+
- v1.30.0 # Support: 28 Apr 2025 - 28 Jun 2025
2424
- v1.29.0 # Support: 28 Dec 2024 - 28 Feb 2025
2525
- v1.28.0 # Support: 28 Aug 2024 - 28 Oct 2024
2626
- v1.27.3 # Support: 28 Apr 2024 - 28 Jun 2024
@@ -60,6 +60,8 @@ jobs:
6060
run: |
6161
make cert-manager
6262
- name: run functional tests
63+
env:
64+
K8S_VERSION: ${{ matrix.k8s-version }}
6365
run: |
6466
cd functional_tests
6567
go test -v

functional_tests/functional_test.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ const (
7070
kindValuesDir = "expected_kind_values"
7171
)
7272

73+
var archRe = regexp.MustCompile("-amd64$|-arm64$|-ppc64le$")
74+
7375
// Test_Functions tests the chart with a real k8s cluster.
7476
// Run the following commands prior to running the test locally:
7577
//
@@ -601,6 +603,10 @@ func testDotNetTraces(t *testing.T) {
601603
require.NoError(t, err)
602604
}
603605

606+
func containerImageShorten(value string) string {
607+
return archRe.ReplaceAllString(value[(strings.LastIndex(value, "/")+1):], "")
608+
}
609+
604610
func shortenNames(value string) string {
605611
if strings.HasPrefix(value, "kube-proxy") {
606612
return "kube-proxy"
@@ -649,9 +655,6 @@ func testK8sClusterReceiverMetrics(t *testing.T) {
649655
require.NoError(t, err)
650656

651657
replaceWithStar := func(string) string { return "*" }
652-
containerImageShorten := func(value string) string {
653-
return value[(strings.LastIndex(value, "/") + 1):]
654-
}
655658

656659
var selected *pmetric.Metrics
657660
for h := len(metricsConsumer.AllMetrics()) - 1; h >= 0; h-- {
@@ -693,6 +696,7 @@ func testK8sClusterReceiverMetrics(t *testing.T) {
693696
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.uid", metricNames...),
694697
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.name", metricNames...),
695698
pmetrictest.IgnoreMetricAttributeValue("k8s.namespace.uid", metricNames...),
699+
pmetrictest.IgnoreMetricAttributeValue("container.image.name", metricNames...),
696700
pmetrictest.IgnoreMetricAttributeValue("container.image.tag", metricNames...),
697701
pmetrictest.IgnoreMetricAttributeValue("k8s.node.uid", metricNames...),
698702
pmetrictest.IgnoreMetricValues(metricNames...),
@@ -722,6 +726,7 @@ func testK8sClusterReceiverMetrics(t *testing.T) {
722726
}
723727

724728
func testAgentLogs(t *testing.T) {
729+
725730
logsConsumer := setupOnce(t).logsConsumer
726731
waitForLogs(t, 5, logsConsumer)
727732

@@ -773,10 +778,14 @@ func testAgentLogs(t *testing.T) {
773778
}
774779
}
775780
}
776-
t.Run("test journald sourcetypes are set", func(t *testing.T) {
777-
assert.Contains(t, journalDsourceTypes, "kube:journald:containerd.service")
778-
assert.Contains(t, journalDsourceTypes, "kube:journald:kubelet.service")
779-
})
781+
if strings.HasPrefix(os.Getenv("K8S_VERSION"), "v1.30") {
782+
t.Log("Skipping test for journald sourcetypes for cluster version 1.30")
783+
} else {
784+
t.Run("test journald sourcetypes are set", func(t *testing.T) {
785+
assert.Contains(t, journalDsourceTypes, "kube:journald:containerd.service")
786+
assert.Contains(t, journalDsourceTypes, "kube:journald:kubelet.service")
787+
})
788+
}
780789
t.Run("test node.js log records", func(t *testing.T) {
781790
assert.NotNil(t, helloWorldLogRecord)
782791
sourceType, ok := helloWorldResource.Attributes().Get("com.splunk.sourcetype")
@@ -933,9 +942,7 @@ func testAgentMetrics(t *testing.T) {
933942
require.NoError(t, err)
934943

935944
replaceWithStar := func(string) string { return "*" }
936-
containerImageShorten := func(value string) string {
937-
return value[(strings.LastIndex(value, "/") + 1):]
938-
}
945+
939946
selectedInternalMetrics := selectMetricSet(expectedInternalMetrics, "otelcol_process_runtime_total_alloc_bytes", agentMetricsConsumer, false)
940947
if selectedInternalMetrics == nil {
941948
t.Skip("No metric batch identified with the right metric count, exiting")
@@ -954,6 +961,7 @@ func testAgentMetrics(t *testing.T) {
954961
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.uid", metricNames...),
955962
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.name", metricNames...),
956963
pmetrictest.IgnoreMetricAttributeValue("k8s.namespace.uid", metricNames...),
964+
pmetrictest.IgnoreMetricAttributeValue("container.image.name", metricNames...),
957965
pmetrictest.IgnoreMetricAttributeValue("container.image.tag", metricNames...),
958966
pmetrictest.IgnoreMetricAttributeValue("k8s.node.uid", metricNames...),
959967
pmetrictest.IgnoreMetricAttributeValue("net.host.name", metricNames...),

0 commit comments

Comments
 (0)