Skip to content

Commit

Permalink
Fix tests address management
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierCazade committed Feb 17, 2023
1 parent 0e1aa23 commit 2cbf593
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions controllers/consoleplugin/consoleplugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ func TestContainerUpdateCheck(t *testing.T) {

//equals specs
plugin := getPluginConfig()
loki := &flowslatest.FlowCollectorLoki{URL: "http://loki:3100/", TenantID: "netobserv"}
spec := &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder := newBuilder(testNamespace, testImage, spec, &certWatcher)
loki := flowslatest.FlowCollectorLoki{URL: "http://loki:3100/", TenantID: "netobserv"}
spec := flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder := newBuilder(testNamespace, testImage, &spec, &certWatcher)
old := builder.deployment("digest")
new := builder.deployment("digest")
report := helper.NewChangeReport("")
Expand Down Expand Up @@ -154,16 +154,16 @@ func TestContainerUpdateCheck(t *testing.T) {
old = new

//new loki config
loki = &flowslatest.FlowCollectorLoki{URL: "http://loki:3100/", TenantID: "netobserv", TLS: flowslatest.ClientTLS{
loki = flowslatest.FlowCollectorLoki{URL: "http://loki:3100/", TenantID: "netobserv", TLS: flowslatest.ClientTLS{
Enable: true,
CACert: flowslatest.CertificateReference{
Type: "configmap",
Name: "cm-name",
CertFile: "ca.crt",
},
}}
spec = &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder = newBuilder(testNamespace, testImage, spec, &certWatcher)
spec = flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder = newBuilder(testNamespace, testImage, &spec, &certWatcher)
new = builder.deployment("digest")
report = helper.NewChangeReport("")
assert.True(helper.PodChanged(&old.Spec.Template, &new.Spec.Template, constants.PluginName, &report))
Expand All @@ -172,8 +172,8 @@ func TestContainerUpdateCheck(t *testing.T) {

//new loki cert name
loki.TLS.CACert.Name = "cm-name-2"
spec = &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder = newBuilder(testNamespace, testImage, spec, &certWatcher)
spec = flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder = newBuilder(testNamespace, testImage, &spec, &certWatcher)
new = builder.deployment("digest")
report = helper.NewChangeReport("")
assert.True(helper.PodChanged(&old.Spec.Template, &new.Spec.Template, constants.PluginName, &report))
Expand All @@ -182,8 +182,8 @@ func TestContainerUpdateCheck(t *testing.T) {

//test again no change
loki.TLS.CACert.Name = "cm-name-2"
spec = &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder = newBuilder(testNamespace, testImage, spec, &certWatcher)
spec = flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder = newBuilder(testNamespace, testImage, &spec, &certWatcher)
new = builder.deployment("digest")
report = helper.NewChangeReport("")
assert.False(helper.PodChanged(&old.Spec.Template, &new.Spec.Template, constants.PluginName, &report))
Expand Down Expand Up @@ -219,9 +219,9 @@ func TestBuiltService(t *testing.T) {

//newly created service should not need update
plugin := getPluginConfig()
loki := &flowslatest.FlowCollectorLoki{URL: "http://foo:1234"}
spec := &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder := newBuilder(testNamespace, testImage, spec, &certWatcher)
loki := flowslatest.FlowCollectorLoki{URL: "http://foo:1234"}
spec := flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder := newBuilder(testNamespace, testImage, &spec, &certWatcher)
newService := builder.service(nil)
report := helper.NewChangeReport("")
assert.Equal(serviceNeedsUpdate(newService, &plugin, &report), false)
Expand All @@ -232,9 +232,9 @@ func TestLabels(t *testing.T) {
assert := assert.New(t)

plugin := getPluginConfig()
loki := &flowslatest.FlowCollectorLoki{URL: "http://foo:1234"}
spec := &flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: *loki}
builder := newBuilder(testNamespace, testImage, spec, &certWatcher)
loki := flowslatest.FlowCollectorLoki{URL: "http://foo:1234"}
spec := flowslatest.FlowCollectorSpec{ConsolePlugin: plugin, Loki: loki}
builder := newBuilder(testNamespace, testImage, &spec, &certWatcher)

// Deployment
depl := builder.deployment("digest")
Expand Down

0 comments on commit 2cbf593

Please sign in to comment.