Skip to content

Commit dfd51f9

Browse files
committed
lint (add go doc to new tests) and TestDynamicSystemView_PluginEnv_successful no longer needs to override version.BuildDate
1 parent a3897ca commit dfd51f9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

vault/dynamic_system_view_test.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,8 @@ func TestDynamicSystemView_GeneratePasswordFromPolicy_failed(t *testing.T) {
289289
}
290290
}
291291

292+
// TestDynamicSystemView_PluginEnv_successful checks that the PluginEnv method returns the expected values in a successful case.
292293
func TestDynamicSystemView_PluginEnv_successful(t *testing.T) {
293-
// This test function cannot be parallelized, because it messes with the
294-
// global version.BuildDate variable.
295-
oldBuildDate := version.BuildDate
296-
testBuildDate := time.Now().Format(time.RFC3339)
297-
version.BuildDate = testBuildDate
298-
defer func() { version.BuildDate = oldBuildDate }()
299-
300294
coreConfig := &CoreConfig{
301295
CredentialBackends: map[string]logical.Factory{},
302296
}
@@ -322,7 +316,7 @@ func TestDynamicSystemView_PluginEnv_successful(t *testing.T) {
322316

323317
expectedVersionInfo := version.GetVersion()
324318

325-
expectedBuildDate, err := time.Parse(time.RFC3339, testBuildDate)
319+
expectedBuildDate, err := version.GetVaultBuildDate()
326320
if err != nil {
327321
t.Fatalf("failed to set up expectedBuildDate: %v", err)
328322
}
@@ -340,6 +334,7 @@ func TestDynamicSystemView_PluginEnv_successful(t *testing.T) {
340334
}
341335
}
342336

337+
// TestDynamicSystemView_PluginEnv_failed checks that the PluginEnv method returns the expected outputs in failure cases.
343338
func TestDynamicSystemView_PluginEnv_failed(t *testing.T) {
344339
cases := map[string]struct {
345340
buildDate string

0 commit comments

Comments
 (0)