-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dashboard-fetch-rate-limit
- Loading branch information
Showing
7 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4415,6 +4415,8 @@ spec: | |
properties: | ||
enabled: | ||
type: boolean | ||
noProxy: | ||
type: string | ||
secureUrl: | ||
type: string | ||
url: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package model | ||
|
||
import ( | ||
"testing" | ||
|
||
grafanav1alpha1 "github.com/grafana-operator/grafana-operator/v4/api/integreatly/v1alpha1" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGrafanaDeployment_httpProxy(t *testing.T) { | ||
t.Run("noProxy is setting", func(t *testing.T) { | ||
cr := &grafanav1alpha1.Grafana{ | ||
Spec: grafanav1alpha1.GrafanaSpec{ | ||
Deployment: &grafanav1alpha1.GrafanaDeployment{ | ||
HttpProxy: &grafanav1alpha1.GrafanaHttpProxy{ | ||
Enabled: true, | ||
URL: "http://1.2.3.4", | ||
SecureURL: "http://1.2.3.4", | ||
NoProxy: ".svc.cluster.local,.svc", | ||
}, | ||
}, | ||
}, | ||
} | ||
deployment := GrafanaDeployment(cr, "", "") | ||
for _, container := range deployment.Spec.Template.Spec.Containers { | ||
if container.Name != "grafana" { | ||
continue | ||
} | ||
|
||
noProxyExist := false | ||
for _, env := range container.Env { | ||
if env.Name == "NO_PROXY" { | ||
noProxyExist = true | ||
assert.Equal(t, ".svc.cluster.local,.svc", env.Value) | ||
} | ||
} | ||
assert.True(t, noProxyExist) | ||
} | ||
}) | ||
|
||
t.Run("noProxy is not setting", func(t *testing.T) { | ||
cr := &grafanav1alpha1.Grafana{ | ||
Spec: grafanav1alpha1.GrafanaSpec{ | ||
Deployment: &grafanav1alpha1.GrafanaDeployment{ | ||
HttpProxy: &grafanav1alpha1.GrafanaHttpProxy{ | ||
Enabled: true, | ||
URL: "http://1.2.3.4", | ||
SecureURL: "http://1.2.3.4", | ||
}, | ||
}, | ||
}, | ||
} | ||
deployment := GrafanaDeployment(cr, "", "") | ||
for _, container := range deployment.Spec.Template.Spec.Containers { | ||
if container.Name != "grafana" { | ||
continue | ||
} | ||
|
||
noProxyExist := false | ||
for _, env := range container.Env { | ||
if env.Name == "NO_PROXY" { | ||
noProxyExist = true | ||
} | ||
} | ||
assert.False(t, noProxyExist) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5038,6 +5038,8 @@ spec: | |
properties: | ||
enabled: | ||
type: boolean | ||
noProxy: | ||
type: string | ||
secureUrl: | ||
type: string | ||
url: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters