Skip to content

Commit

Permalink
Merge pull request #378 from DataDog/davidor/fix-old-version-refs
Browse files Browse the repository at this point in the history
[controllers/datadogagent] Fix reference to DatadogAgent
  • Loading branch information
clamoriniere committed Sep 21, 2021
2 parents 2708a73 + 5b9738a commit d8360a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions controllers/datadogagent/labels.go
@@ -1,10 +1,16 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

package datadogagent

import (
"strings"

datadoghqv1alpha1 "github.com/DataDog/datadog-operator/api/v1alpha1"
"k8s.io/apimachinery/pkg/types"

"github.com/DataDog/datadog-operator/apis/datadoghq/v1alpha1"
)

const (
Expand All @@ -25,7 +31,7 @@ type PartOfLabelValue struct {

// NewPartOfLabelValue creates an instance of PartOfLabelValue from a
// DatadogAgent.
func NewPartOfLabelValue(dda *datadoghqv1alpha1.DatadogAgent) *PartOfLabelValue {
func NewPartOfLabelValue(dda *v1alpha1.DatadogAgent) *PartOfLabelValue {
value := strings.ReplaceAll(dda.Namespace, partOfSplitChar, partOfEscapedSplitChar) +
partOfSplitChar +
strings.ReplaceAll(dda.Name, partOfSplitChar, partOfEscapedSplitChar)
Expand Down
13 changes: 10 additions & 3 deletions controllers/datadogagent/labels_test.go
@@ -1,11 +1,18 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

package datadogagent

import (
datadoghqv1alpha1 "github.com/DataDog/datadog-operator/api/v1alpha1"
"testing"

"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"testing"

"github.com/DataDog/datadog-operator/apis/datadoghq/v1alpha1"
)

func Test_NamespacedName(t *testing.T) {
Expand All @@ -31,7 +38,7 @@ func Test_NamespacedName(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
dda := datadoghqv1alpha1.DatadogAgent{
dda := v1alpha1.DatadogAgent{
ObjectMeta: metav1.ObjectMeta{
Name: tt.agentName,
Namespace: tt.agentNamespace,
Expand Down

0 comments on commit d8360a9

Please sign in to comment.