mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 23:21:08 +02:00
* require explicit value for disable_mlock * set disable_mlock back to true for all docker tests * fix build error * update test config files * change explicit mlock check to apply to integrated storage only. * formatting and typo fixes * added test for raft * remove erroneous test * remove unecessary doc line * remove unecessary var * pr suggestions * test compile fix * add mlock config value to enos tests * enos lint * update enos tests to pass disable_mlock value * move mlock error to runtime to check for env var * fixed mlock config detection logic * call out mlock on/off tradeoffs to docs * rewording production hardening section on mlock for clarity * update error message when missing disable_mlock value to help customers with the previous default * fix config doc error and update production-hardening doc to align with existing recommendations. * remove extra check for mlock config value * fix docker recovery test * Update changelog/29974.txt Explicitly call out that Vault will not start without disable_mlock included in the config. Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com> * more docker test experimentation. * passing disable_mlock into test cluster * add VAULT_DISABLE_MLOCK envvar to docker tests and pass through the value * add missing envvar for docker env test * upate additional docker test disable_mlock values * Apply suggestions from code review Use active voice. Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> --------- Co-authored-by: Kuba Wieczorek <kuba.wieczorek@hashicorp.com> Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com>
40 lines
838 B
Go
40 lines
838 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package docker
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestSettingEnvsToContainer(t *testing.T) {
|
|
expectedEnv := "TEST_ENV=value1"
|
|
expectedEnv2 := "TEST_ENV2=value2"
|
|
opts := &DockerClusterOptions{
|
|
ImageRepo: "hashicorp/vault",
|
|
ImageTag: "latest",
|
|
Envs: []string{expectedEnv, expectedEnv2},
|
|
DisableMlock: true,
|
|
}
|
|
cluster := NewTestDockerCluster(t, opts)
|
|
defer cluster.Cleanup()
|
|
|
|
envs := cluster.GetActiveClusterNode().Container.Config.Env
|
|
|
|
if !findEnv(envs, expectedEnv) {
|
|
t.Errorf("Missing ENV variable: %s", expectedEnv)
|
|
}
|
|
if !findEnv(envs, expectedEnv2) {
|
|
t.Errorf("Missing ENV variable: %s", expectedEnv2)
|
|
}
|
|
}
|
|
|
|
func findEnv(envs []string, env string) bool {
|
|
for _, e := range envs {
|
|
if e == env {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|