Fix eventing and worker name setup (#2204)

* Don't automatically create worker names, as this is now invalid for
  PKI workers
* Fix a check in dev that clears out name/description in exactly the
  wrong cases
* Change eventing setup to use a hostname-based ID instead of the name
  (which could change on every start anyways)
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2022-06-15 20:01:03 -04:00
1 parent 214ca9a668
commit 9a4545e59e
9 files changed
+75 -90

No files matched your search

+9 -5
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net"
"os"
"strconv"
"strings"
"testing"
@@ -542,10 +543,7 @@ func TestControllerConfig(t testing.TB, ctx context.Context, tc *TestController,
opts.Config.Controller = new(config.Controller)
}
if opts.Config.Controller.Name == "" {
opts.Config.Controller.Name, err = opts.Config.Controller.InitNameIfEmpty()
if err != nil {
t.Fatal(err)
}
require.NoError(t, opts.Config.Controller.InitNameIfEmpty())
}
opts.Config.Controller.SchedulerRunJobInterval = opts.SchedulerRunJobInterval
@@ -572,7 +570,13 @@ func TestControllerConfig(t testing.TB, ctx context.Context, tc *TestController,
tc.b.Eventer = e
event.TestWithoutEventing(t) // this ensures the sys eventer will also stop eventing
default:
if err := tc.b.SetupEventing(tc.b.Logger, tc.b.StderrLock, opts.Config.Controller.Name, base.WithEventerConfig(opts.Config.Eventing)); err != nil {
serverName, err := os.Hostname()
if err != nil {
t.Fatal(err)
}
serverName = fmt.Sprintf("%s/controller", serverName)
if err := tc.b.SetupEventing(tc.b.Logger, tc.b.StderrLock, serverName, base.WithEventerConfig(opts.Config.Eventing)); err != nil {
t.Fatal(err)
}
}