Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
nightly:
collectorChart:
name: nr_backend
version: 0.1.0
ec2:
enabled: true
testCaseSpecs:
Expand Down
1 change: 0 additions & 1 deletion distributions/nrdot-collector/test/spec-nightly.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
nightly:
collectorChart:
name: nr_backend
version: 0.1.0
ec2:
enabled: true
testCaseSpecs:
Expand Down
2 changes: 1 addition & 1 deletion test/charts/nr_backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: nrdot-nr-backend
description: A Helm chart for deploying an nrdot collector as a DaemonSet writing to New Relic
version: 0.2.0
version: 0.3.0
appVersion: "1.0"
2 changes: 1 addition & 1 deletion test/charts/nr_backend/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ spec:
fieldRef:
fieldPath: spec.nodeName
- name: OTEL_RESOURCE_ATTRIBUTES
value: "host.name={{ .Values.collector.hostname }}-$(KUBE_NODE_NAME)"
value: "testKey={{ .Values.testKey }}-$(KUBE_NODE_NAME)"
3 changes: 1 addition & 2 deletions test/charts/nr_backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ secrets:
nrBackendUrl: PLACEHOLDER
nrIngestKey: PLACEHOLDER

collector:
hostname: nrdot-collector-default-hostname
testKey: testKey-default-value

clusterName: default-cluster-name
12 changes: 6 additions & 6 deletions test/e2e/nightly/nightly_collector_nr_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import (
)

var ec2Ubuntu22 = spec.NightlySystemUnderTest{
HostNamePattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "ec2_ubuntu22_04"),
TestKeyPattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "ec2_ubuntu22_04"),
SkipIf: func(testSpec *spec.TestSpec) bool {
return !testSpec.Nightly.EC2.Enabled
},
}
var ec2Ubuntu24 = spec.NightlySystemUnderTest{
HostNamePattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "ec2_ubuntu24_04"),
TestKeyPattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "ec2_ubuntu24_04"),
SkipIf: func(testSpec *spec.TestSpec) bool {
return !testSpec.Nightly.EC2.Enabled
},
}
var k8sNode = spec.NightlySystemUnderTest{
HostNamePattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "k8s_node"),
TestKeyPattern: testutil.NewNrQueryHostNamePattern("nightly", testutil.Wildcard, "k8s_node"),
}

func TestNightlyCollectorWithNrBackend(t *testing.T) {
Expand All @@ -35,12 +35,12 @@ func TestNightlyCollectorWithNrBackend(t *testing.T) {

for _, sut := range []spec.NightlySystemUnderTest{ec2Ubuntu22, ec2Ubuntu24, k8sNode} {
if sut.SkipIf != nil && sut.SkipIf(testSpec) {
t.Logf("Skipping nightly system-under-test: %s", sut.HostNamePattern)
t.Logf("Skipping nightly system-under-test: %s", sut.TestKeyPattern)
continue
}
testEnvironment := map[string]string{
"clusterName": envutil.GetK8sContextName(),
"hostName": sut.HostNamePattern,
"testKey": sut.TestKeyPattern,
}
for _, testCaseSpecName := range testSpec.Nightly.TestCaseSpecs {
testCaseSpec := spec.LoadTestCaseSpec(testCaseSpecName)
Expand All @@ -52,7 +52,7 @@ func TestNightlyCollectorWithNrBackend(t *testing.T) {

whereClause := testCaseSpec.RenderWhereClause(testEnvironment)
for caseName, testCase := range testCaseSpec.GetTestCasesWithout(sut.ExcludedMetrics) {
t.Run(fmt.Sprintf("%s/%s/%s", sut.HostNamePattern, testCaseSpecName, caseName), func(t *testing.T) {
t.Run(fmt.Sprintf("%s/%s/%s", sut.TestKeyPattern, testCaseSpecName, caseName), func(t *testing.T) {
t.Parallel()
assertionFactory := assert.NewNrMetricAssertionFactory(
whereClause,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/util/spec/host.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
whereClause:
template: "WHERE host.name like '{{ .hostName }}'"
template: "WHERE testKey like '{{ .testKey }}'"
vars:
- hostName
- testKey

testCases:
host_receiver_cpu.utilization_user:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/util/spec/nightly.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package spec

type NightlySystemUnderTest struct {
HostNamePattern string
TestKeyPattern string
ExcludedMetrics []string
SkipIf func(testSpec *TestSpec) bool
}
4 changes: 2 additions & 2 deletions test/e2e/util/spec/test_case_spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
func TestRenderWhereClause(t *testing.T) {
testCaseSpec := LoadTestCaseSpec("host")
actual := testCaseSpec.RenderWhereClause(map[string]string{
"hostName": "nrdot-collector-host-foobar",
"testKey": "nrdot-collector-host-foobar",
})
if actual != "WHERE host.name like 'nrdot-collector-host-foobar'" {
if actual != "WHERE testKey like 'nrdot-collector-host-foobar'" {
t.Fatalf("unexpected where clause: %s", actual)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/terraform/modules/ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ resource "aws_instance" "ubuntu" {
################################################
echo 'Configuring Collector'
echo 'NEW_RELIC_LICENSE_KEY=${var.nr_ingest_key}' >> /etc/${var.collector_distro}/${var.collector_distro}.conf
echo "OTEL_RESOURCE_ATTRIBUTES='host.name=${local.collector_reported_hostname_prefix}-${local.instance_config[count.index].hostname_suffix}'" >> /etc/${var.collector_distro}/${var.collector_distro}.conf
echo "OTEL_RESOURCE_ATTRIBUTES='testKey=${local.collector_reported_hostname_prefix}-${local.instance_config[count.index].hostname_suffix}'" >> /etc/${var.collector_distro}/${var.collector_distro}.conf
systemctl reload-or-restart ${var.collector_distro}.service
EOF
}
9 changes: 4 additions & 5 deletions test/terraform/nightly/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ data "aws_ecr_repository" "ecr_repo" {
}

resource "helm_release" "ci_e2e_nightly_nr_backend" {
count = local.chart_name == "nr_backend" ? 1 : 0
name = "nightly-nr-backend-${var.distro}"
chart = "../../charts/nr_backend"
version = local.chart_version
count = local.chart_name == "nr_backend" ? 1 : 0
name = "nightly-nr-backend-${var.distro}"
chart = "../../charts/nr_backend"

create_namespace = true
namespace = local.k8s_namespace
Expand Down Expand Up @@ -54,7 +53,7 @@ resource "helm_release" "ci_e2e_nightly_nr_backend" {
}

set {
name = "collector.hostname"
name = "testKey"
value = "${var.test_environment}-${random_string.deploy_id.result}-${var.distro}-k8s_node"
}

Expand Down
Loading