feat(event): Remove BOUNDARY_DEVELOPER_ENABLE_EVENTS env var
This commit is contained in:
1 parent
1af803780c
commit
4599e64cab
12 files changed
-79
No files matched your search
@@ -3,12 +3,9 @@ package event
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
)
|
||||
|
||||
@@ -170,11 +167,6 @@ func WriteError(ctx context.Context, caller Op, e error, opt ...Option) {
|
||||
// WithRequest, WithResponse, WithAuth, WithId, WithFlush and WithRequestInfo.
|
||||
// All other options are ignored.
|
||||
func WriteAudit(ctx context.Context, caller Op, opt ...Option) error {
|
||||
// TODO (jimlambrt) 6/2021: remove this feature flag envvar when events are
|
||||
// generally available.
|
||||
if !strings.EqualFold(os.Getenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS), "true") {
|
||||
return nil
|
||||
}
|
||||
const op = "event.WriteAudit"
|
||||
if ctx == nil {
|
||||
return fmt.Errorf("%s: missing context: %w", op, ErrInvalidParameter)
|
||||
|
||||
@@ -261,8 +261,6 @@ func Test_EventerFromContext(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_WriteObservation(t *testing.T) {
|
||||
event.TestEnableEventing(t, true)
|
||||
|
||||
// this test and its subtests cannot be run in parallel because of it's
|
||||
// dependency on the sysEventer
|
||||
|
||||
@@ -505,7 +503,6 @@ func Test_WriteObservation(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_Filtering(t *testing.T) {
|
||||
event.TestEnableEventing(t, true)
|
||||
testLock := &sync.Mutex{}
|
||||
testLogger := hclog.New(&hclog.LoggerOptions{
|
||||
Mutex: testLock,
|
||||
@@ -631,8 +628,6 @@ func testObservationJsonFromCtx(t *testing.T, ctx context.Context, caller event.
|
||||
}
|
||||
|
||||
func Test_WriteAudit(t *testing.T) {
|
||||
event.TestEnableEventing(t, true)
|
||||
|
||||
// this test and its subtests cannot be run in parallel because of it's
|
||||
// dependency on the sysEventer
|
||||
now := time.Now()
|
||||
@@ -970,8 +965,6 @@ func Test_WriteAudit(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_WriteError(t *testing.T) {
|
||||
event.TestEnableEventing(t, true)
|
||||
|
||||
// this test and its subtests cannot be run in parallel because of it's
|
||||
// dependency on the sysEventer
|
||||
now := time.Now()
|
||||
|
||||
@@ -4,12 +4,10 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-secure-stdlib/strutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -20,9 +18,6 @@ func TestEventer_Gating(t *testing.T) {
|
||||
t.Parallel()
|
||||
require := require.New(t)
|
||||
|
||||
// FIXME: Remove this when no longer needed:
|
||||
os.Setenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS, "true")
|
||||
|
||||
buffer := new(bytes.Buffer)
|
||||
eventerConfig := EventerConfig{
|
||||
AuditEnabled: true,
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/boundary/globals"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
|
||||
"github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/groups"
|
||||
"github.com/hashicorp/eventlogger"
|
||||
@@ -15,20 +14,6 @@ import (
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
// TestEnableEventing will enable eventing via it's envvar
|
||||
// globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS
|
||||
func TestEnableEventing(t *testing.T, enable bool) {
|
||||
t.Helper()
|
||||
if enable {
|
||||
os.Setenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS, "true")
|
||||
t.Cleanup(func() {
|
||||
defer os.Unsetenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS)
|
||||
})
|
||||
} else {
|
||||
os.Unsetenv(globals.BOUNDARY_DEVELOPER_ENABLE_EVENTS)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGetEventerConfig is a test accessor for the eventer's config
|
||||
func TestGetEventerConfig(t *testing.T, e *Eventer) EventerConfig {
|
||||
t.Helper()
|
||||
|
||||
Reference in new issue
Block a user