Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
Using system.Namespace() in tests instead of the hardcoded namespace …
Browse files Browse the repository at this point in the history
…name
  • Loading branch information
AlexandraRoatis committed Nov 23, 2020
1 parent 203825d commit 0771683
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions pkg/apis/configs/brokerdelivery/br_delivery_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"knative.dev/pkg/system"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -116,7 +117,7 @@ func TestNewDefaultsConfigFromConfigMapWithError(t *testing.T) {
"empty data": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{},
Expand All @@ -125,7 +126,7 @@ func TestNewDefaultsConfigFromConfigMapWithError(t *testing.T) {
"missing key": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{
Expand All @@ -136,7 +137,7 @@ func TestNewDefaultsConfigFromConfigMapWithError(t *testing.T) {
"invalid YAML": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/configs/dataresidency/dataresidency_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"

"cloud.google.com/go/pubsub"
"knative.dev/pkg/system"

"github.com/google/go-cmp/cmp"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -126,7 +127,7 @@ func TestNewDefaultsConfigFromConfigMapWithKeyError(t *testing.T) {
"empty data": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{},
Expand All @@ -135,7 +136,7 @@ func TestNewDefaultsConfigFromConfigMapWithKeyError(t *testing.T) {
"missing key": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{
Expand All @@ -146,7 +147,7 @@ func TestNewDefaultsConfigFromConfigMapWithKeyError(t *testing.T) {
"wrong format": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/configs/gcpauth/gcp_auth_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"knative.dev/pkg/system"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -120,7 +121,7 @@ func TestNewDefaultsConfigFromConfigMapWithError(t *testing.T) {
"empty data": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{},
Expand All @@ -129,7 +130,7 @@ func TestNewDefaultsConfigFromConfigMapWithError(t *testing.T) {
"missing key": {
config: &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Namespace: "events-system",
Namespace: system.Namespace(),
Name: configName,
},
Data: map[string]string{
Expand Down

0 comments on commit 0771683

Please sign in to comment.