Skip to content

Commit

Permalink
remove TestDynamicSystemView_PluginEnv_failed since it's incompatible…
Browse files Browse the repository at this point in the history
… with ent
  • Loading branch information
helenfufu committed Dec 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent de115fb commit f96ea93
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions vault/dynamic_system_view_test.go
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ import (
"fmt"
"reflect"
"sort"
"strings"
"testing"
"time"

@@ -334,62 +333,6 @@ func TestDynamicSystemView_PluginEnv_successful(t *testing.T) {
}
}

// TestDynamicSystemView_PluginEnv_failed checks that the PluginEnv method returns the expected outputs in failure cases.
func TestDynamicSystemView_PluginEnv_failed(t *testing.T) {
cases := map[string]struct {
buildDate string
expectedErrContains string
}{
"empty build date": {
buildDate: "",
expectedErrContains: "failed to parse build date based on RFC3339",
},
"invalid build date": {
buildDate: "not-rfc3339",
expectedErrContains: "failed to parse build date based on RFC3339",
},
}

for name, c := range cases {
t.Run(name, func(t *testing.T) {
// This test function cannot be parallelized, because it messes with the
// global version.BuildDate variable.
oldBuildDate := version.BuildDate
version.BuildDate = c.buildDate
defer func() { version.BuildDate = oldBuildDate }()

coreConfig := &CoreConfig{
CredentialBackends: map[string]logical.Factory{},
}

cluster := NewTestCluster(t, coreConfig, &TestClusterOptions{})

cluster.Start()
defer cluster.Cleanup()

core := cluster.Cores[0].Core
TestWaitActive(t, core)

ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()

ctx = namespace.RootContext(ctx)
dsv := TestDynamicSystemView(cluster.Cores[0].Core, nil)

pluginEnv, err := dsv.PluginEnv(ctx)
if err == nil {
t.Fatalf("error expected, got nil")
}
if !strings.Contains(err.Error(), c.expectedErrContains) {
t.Fatalf("error %q does not contain %q", err, c.expectedErrContains)
}
if pluginEnv != nil {
t.Fatalf("pluginEnv: got %v, expected nil", pluginEnv)
}
})
}
}

type runes []rune

func (r runes) Len() int { return len(r) }

0 comments on commit f96ea93

Please sign in to comment.