Fix worker auth rotation test (#3243)

Most of the changes here are changes or enhancements that are useful for
tests. The crux of the issue was that I had pulled up one var to the
package level so it could be read from tests, but that var was not being
reset between tests. It's not even used in tests anymore, so I put it
back to function-local.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2023-05-24 23:33:51 -04:00
1 parent ace2def49d
commit e8559d142a
8 files changed
+57 -27

No files matched your search

+20 -2
View File
@@ -2,7 +2,10 @@
package config
import "testing"
import (
"os"
"testing"
)
// getOpts - iterate the inbound Options and return a struct
func getOpts(opt ...Option) options {
@@ -25,7 +28,22 @@ type options struct {
}
func getDefaultOptions() options {
return options{}
opts := options{}
if os.Getenv("BOUNDARY_ENABLE_TEST_SYS_EVENTS") != "" {
opts.withSysEventsEnabled = true
}
if os.Getenv("BOUNDARY_ENABLE_TEST_AUDIT_EVENTS") != "" {
opts.withAuditEventsEnabled = true
}
if os.Getenv("BOUNDARY_ENABLE_TEST_OBSERVATIONS") != "" {
opts.withObservationsEnabled = true
}
if os.Getenv("BOUNDARY_ENABLE_TEST_ERROR_EVENTS") != "" {
opts.testWithErrorEventsEnabled = true
}
return opts
}
// WithSysEventsEnabled provides an option for enabling system events