open-nomad/nomad/secure_variable_mock_test.go
Charlie Voiselle 2019eab2c8 Provide mock secure variables implementation (#12980)
* Add SecureVariable mock
* Add SecureVariableStub
* Add SecureVariable Copy and Stub funcs
2022-07-11 13:34:03 -04:00

29 lines
548 B
Go

package nomad
import (
"testing"
"github.com/hashicorp/nomad/nomad/mock"
"github.com/stretchr/testify/require"
)
func TestMockVariables(t *testing.T) {
defer mvs.Reset()
sv1 := mock.SecureVariable()
mvs.Add(sv1.Path, *sv1)
out := mvs.List("")
require.NotNil(t, out)
require.Len(t, out, 1)
}
func TestDeleteMockVariables(t *testing.T) {
defer mvs.Reset()
sv1 := mock.SecureVariable()
mvs.Add(sv1.Path, *sv1)
out := mvs.List("")
require.NotNil(t, out)
require.Len(t, out, 1)
mvs.Delete(sv1.Path)
require.Empty(t, mvs.List(""))
}