mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-27 17:41:13 +02:00
Merge pull request #1295 from hashicorp/acceptance-tests
Added AcceptanceTest boolean to logical.TestCase
This commit is contained in:
commit
0c88201a9f
@ -10,7 +10,8 @@ import (
|
|||||||
|
|
||||||
func TestBackend_basic(t *testing.T) {
|
func TestBackend_basic(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepMapAppId(t),
|
testAccStepMapAppId(t),
|
||||||
testAccStepMapUserId(t),
|
testAccStepMapUserId(t),
|
||||||
@ -25,7 +26,8 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
|
|
||||||
func TestBackend_cidr(t *testing.T) {
|
func TestBackend_cidr(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepMapAppIdDisplayName(t),
|
testAccStepMapAppIdDisplayName(t),
|
||||||
testAccStepMapUserIdCidr(t, "192.168.1.0/16"),
|
testAccStepMapUserIdCidr(t, "192.168.1.0/16"),
|
||||||
@ -38,7 +40,8 @@ func TestBackend_cidr(t *testing.T) {
|
|||||||
|
|
||||||
func TestBackend_displayName(t *testing.T) {
|
func TestBackend_displayName(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepMapAppIdDisplayName(t),
|
testAccStepMapAppIdDisplayName(t),
|
||||||
testAccStepMapUserId(t),
|
testAccStepMapUserId(t),
|
||||||
|
@ -48,7 +48,8 @@ func TestBackend_CertWrites(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tc := logicaltest.TestCase{
|
tc := logicaltest.TestCase{
|
||||||
Backend: testFactory(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: testFactory(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepCert(t, "aaa", ca1, "foo", false),
|
testAccStepCert(t, "aaa", ca1, "foo", false),
|
||||||
testAccStepCert(t, "bbb", ca2, "foo", false),
|
testAccStepCert(t, "bbb", ca2, "foo", false),
|
||||||
@ -68,7 +69,8 @@ func TestBackend_basic_CA(t *testing.T) {
|
|||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: testFactory(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: testFactory(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepCert(t, "web", ca, "foo", false),
|
testAccStepCert(t, "web", ca, "foo", false),
|
||||||
testAccStepLogin(t, connState),
|
testAccStepLogin(t, connState),
|
||||||
@ -94,7 +96,8 @@ func TestBackend_CRLs(t *testing.T) {
|
|||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: testFactory(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: testFactory(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepCertNoLease(t, "web", ca, "foo"),
|
testAccStepCertNoLease(t, "web", ca, "foo"),
|
||||||
testAccStepLoginDefaultLease(t, connState),
|
testAccStepLoginDefaultLease(t, connState),
|
||||||
@ -116,7 +119,8 @@ func TestBackend_basic_singleCert(t *testing.T) {
|
|||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: testFactory(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: testFactory(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepCert(t, "web", ca, "foo", false),
|
testAccStepCert(t, "web", ca, "foo", false),
|
||||||
testAccStepLogin(t, connState),
|
testAccStepLogin(t, connState),
|
||||||
@ -129,7 +133,8 @@ func TestBackend_untrusted(t *testing.T) {
|
|||||||
connState := testConnState(t, "test-fixtures/keys/cert.pem",
|
connState := testConnState(t, "test-fixtures/keys/cert.pem",
|
||||||
"test-fixtures/keys/key.pem", "test-fixtures/root/rootcacert.pem")
|
"test-fixtures/keys/key.pem", "test-fixtures/root/rootcacert.pem")
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: testFactory(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: testFactory(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepLoginInvalid(t, connState),
|
testAccStepLoginInvalid(t, connState),
|
||||||
},
|
},
|
||||||
|
@ -47,8 +47,9 @@ func TestBackend_Config(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testConfigWrite(t, config_data1),
|
testConfigWrite(t, config_data1),
|
||||||
testLoginWrite(t, login_data, expectedTTL1.Nanoseconds(), false),
|
testLoginWrite(t, login_data, expectedTTL1.Nanoseconds(), false),
|
||||||
@ -103,8 +104,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccMap(t, "default", "root"),
|
testAccMap(t, "default", "root"),
|
||||||
|
@ -30,7 +30,8 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
b := factory(t)
|
b := factory(t)
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfigUrl(t),
|
testAccStepConfigUrl(t),
|
||||||
testAccStepGroup(t, "scientists", "foo"),
|
testAccStepGroup(t, "scientists", "foo"),
|
||||||
@ -45,7 +46,8 @@ func TestBackend_basic_authbind(t *testing.T) {
|
|||||||
b := factory(t)
|
b := factory(t)
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfigUrlWithAuthBind(t),
|
testAccStepConfigUrlWithAuthBind(t),
|
||||||
testAccStepGroup(t, "scientists", "foo"),
|
testAccStepGroup(t, "scientists", "foo"),
|
||||||
@ -60,7 +62,8 @@ func TestBackend_basic_discover(t *testing.T) {
|
|||||||
b := factory(t)
|
b := factory(t)
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfigUrlWithDiscover(t),
|
testAccStepConfigUrlWithDiscover(t),
|
||||||
testAccStepGroup(t, "scientists", "foo"),
|
testAccStepGroup(t, "scientists", "foo"),
|
||||||
@ -75,7 +78,8 @@ func TestBackend_basic_nogroupdn(t *testing.T) {
|
|||||||
b := factory(t)
|
b := factory(t)
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfigUrlNoGroupDN(t),
|
testAccStepConfigUrlNoGroupDN(t),
|
||||||
testAccStepGroup(t, "scientists", "foo"),
|
testAccStepGroup(t, "scientists", "foo"),
|
||||||
@ -90,7 +94,8 @@ func TestBackend_groupCrud(t *testing.T) {
|
|||||||
b := factory(t)
|
b := factory(t)
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepGroup(t, "g1", "foo"),
|
testAccStepGroup(t, "g1", "foo"),
|
||||||
testAccStepReadGroup(t, "g1", "foo"),
|
testAccStepReadGroup(t, "g1", "foo"),
|
||||||
@ -212,7 +217,8 @@ func TestBackend_userCrud(t *testing.T) {
|
|||||||
b := Backend()
|
b := Backend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepUser(t, "g1", "bar"),
|
testAccStepUser(t, "g1", "bar"),
|
||||||
testAccStepReadUser(t, "g1", "bar"),
|
testAccStepReadUser(t, "g1", "bar"),
|
||||||
|
@ -54,7 +54,8 @@ func TestBackend_TTLDurations(t *testing.T) {
|
|||||||
t.Fatalf("Unable to create backend: %s", err)
|
t.Fatalf("Unable to create backend: %s", err)
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testUsersWrite(t, "test", data1, true),
|
testUsersWrite(t, "test", data1, true),
|
||||||
testUsersWrite(t, "test", data2, true),
|
testUsersWrite(t, "test", data2, true),
|
||||||
@ -78,7 +79,8 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
t.Fatalf("Unable to create backend: %s", err)
|
t.Fatalf("Unable to create backend: %s", err)
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepUser(t, "web", "password", "foo"),
|
testAccStepUser(t, "web", "password", "foo"),
|
||||||
testAccStepLogin(t, "web", "password", []string{"default", "foo"}),
|
testAccStepLogin(t, "web", "password", []string{"default", "foo"}),
|
||||||
@ -99,7 +101,8 @@ func TestBackend_userCrud(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepUser(t, "web", "password", "foo"),
|
testAccStepUser(t, "web", "password", "foo"),
|
||||||
testAccStepReadUser(t, "web", "foo"),
|
testAccStepReadUser(t, "web", "foo"),
|
||||||
@ -122,7 +125,8 @@ func TestBackend_userCreateOperation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testUserCreateOperation(t, "web", "password", "foo"),
|
testUserCreateOperation(t, "web", "password", "foo"),
|
||||||
testAccStepLogin(t, "web", "password", []string{"default", "foo"}),
|
testAccStepLogin(t, "web", "password", []string{"default", "foo"}),
|
||||||
@ -143,7 +147,8 @@ func TestBackend_passwordUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepUser(t, "web", "password", "foo"),
|
testAccStepUser(t, "web", "password", "foo"),
|
||||||
testAccStepReadUser(t, "web", "foo"),
|
testAccStepReadUser(t, "web", "foo"),
|
||||||
@ -168,7 +173,8 @@ func TestBackend_policiesUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepUser(t, "web", "password", "foo"),
|
testAccStepUser(t, "web", "password", "foo"),
|
||||||
testAccStepReadUser(t, "web", "foo"),
|
testAccStepReadUser(t, "web", "foo"),
|
||||||
|
@ -26,8 +26,9 @@ func getBackend(t *testing.T) logical.Backend {
|
|||||||
|
|
||||||
func TestBackend_basic(t *testing.T) {
|
func TestBackend_basic(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: getBackend(t),
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: getBackend(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWritePolicy(t, "test", testPolicy),
|
testAccStepWritePolicy(t, "test", testPolicy),
|
||||||
@ -38,8 +39,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
|
|
||||||
func TestBackend_basicSTS(t *testing.T) {
|
func TestBackend_basicSTS(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: getBackend(t),
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: getBackend(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWritePolicy(t, "test", testPolicy),
|
testAccStepWritePolicy(t, "test", testPolicy),
|
||||||
@ -57,7 +59,8 @@ func TestBackend_policyCrud(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: getBackend(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: getBackend(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWritePolicy(t, "test", testPolicy),
|
testAccStepWritePolicy(t, "test", testPolicy),
|
||||||
@ -261,8 +264,9 @@ func testAccStepWriteArnPolicyRef(t *testing.T, name string, arn string) logical
|
|||||||
|
|
||||||
func TestBackend_basicPolicyArnRef(t *testing.T) {
|
func TestBackend_basicPolicyArnRef(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: getBackend(t),
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: getBackend(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWriteArnPolicyRef(t, "test", testPolicyArn),
|
testAccStepWriteArnPolicyRef(t, "test", testPolicyArn),
|
||||||
@ -273,7 +277,8 @@ func TestBackend_basicPolicyArnRef(t *testing.T) {
|
|||||||
|
|
||||||
func TestBackend_policyArnCrud(t *testing.T) {
|
func TestBackend_policyArnCrud(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: getBackend(t),
|
AcceptanceTest: true,
|
||||||
|
Backend: getBackend(t),
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWriteArnPolicyRef(t, "test", testPolicyArn),
|
testAccStepWriteArnPolicyRef(t, "test", testPolicyArn),
|
||||||
|
@ -15,8 +15,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
b := Backend()
|
b := Backend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -29,8 +30,9 @@ func TestBackend_roleCrud(t *testing.T) {
|
|||||||
b := Backend()
|
b := Backend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
|
@ -28,8 +28,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
|
|
||||||
b, _ := Factory(logical.TestBackendConfig())
|
b, _ := Factory(logical.TestBackendConfig())
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, config),
|
testAccStepConfig(t, config),
|
||||||
testAccStepWritePolicy(t, "test", testPolicy, ""),
|
testAccStepWritePolicy(t, "test", testPolicy, ""),
|
||||||
@ -48,8 +49,9 @@ func TestBackend_management(t *testing.T) {
|
|||||||
|
|
||||||
b, _ := Factory(logical.TestBackendConfig())
|
b, _ := Factory(logical.TestBackendConfig())
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, config),
|
testAccStepConfig(t, config),
|
||||||
testAccStepWriteManagementPolicy(t, "test", ""),
|
testAccStepWriteManagementPolicy(t, "test", ""),
|
||||||
@ -68,8 +70,9 @@ func TestBackend_crud(t *testing.T) {
|
|||||||
|
|
||||||
b, _ := Factory(logical.TestBackendConfig())
|
b, _ := Factory(logical.TestBackendConfig())
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", testPolicy, ""),
|
testAccStepWritePolicy(t, "test", testPolicy, ""),
|
||||||
testAccStepReadPolicy(t, "test", testPolicy, 0),
|
testAccStepReadPolicy(t, "test", testPolicy, 0),
|
||||||
@ -88,8 +91,9 @@ func TestBackend_role_lease(t *testing.T) {
|
|||||||
|
|
||||||
b, _ := Factory(logical.TestBackendConfig())
|
b, _ := Factory(logical.TestBackendConfig())
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", testPolicy, "6h"),
|
testAccStepWritePolicy(t, "test", testPolicy, "6h"),
|
||||||
testAccStepReadPolicy(t, "test", testPolicy, 6*time.Hour),
|
testAccStepReadPolicy(t, "test", testPolicy, 6*time.Hour),
|
||||||
|
@ -15,8 +15,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
b, _ := Factory(logical.TestBackendConfig())
|
b, _ := Factory(logical.TestBackendConfig())
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -29,8 +30,9 @@ func TestBackend_roleCrud(t *testing.T) {
|
|||||||
b := Backend()
|
b := Backend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -45,8 +47,9 @@ func TestBackend_leaseWriteRead(t *testing.T) {
|
|||||||
b := Backend()
|
b := Backend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t),
|
testAccStepConfig(t),
|
||||||
testAccStepWriteLease(t),
|
testAccStepWriteLease(t),
|
||||||
|
@ -21,8 +21,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
"value": os.Getenv("MYSQL_DSN"),
|
"value": os.Getenv("MYSQL_DSN"),
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d1, false),
|
testAccStepConfig(t, d1, false),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -49,8 +50,9 @@ func TestBackend_configConnection(t *testing.T) {
|
|||||||
d4 := map[string]interface{}{}
|
d4 := map[string]interface{}{}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d1, false),
|
testAccStepConfig(t, d1, false),
|
||||||
testAccStepConfig(t, d2, false),
|
testAccStepConfig(t, d2, false),
|
||||||
@ -67,8 +69,9 @@ func TestBackend_roleCrud(t *testing.T) {
|
|||||||
"connection_url": os.Getenv("MYSQL_DSN"),
|
"connection_url": os.Getenv("MYSQL_DSN"),
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d, false),
|
testAccStepConfig(t, d, false),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -86,8 +89,9 @@ func TestBackend_leaseWriteRead(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d, false),
|
testAccStepConfig(t, d, false),
|
||||||
testAccStepWriteLease(t),
|
testAccStepWriteLease(t),
|
||||||
|
@ -54,8 +54,9 @@ func TestBackend_RSAKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
Steps: []logicaltest.TestStep{},
|
Backend: b,
|
||||||
|
Steps: []logicaltest.TestStep{},
|
||||||
}
|
}
|
||||||
|
|
||||||
stepCount = len(testCase.Steps)
|
stepCount = len(testCase.Steps)
|
||||||
@ -88,8 +89,9 @@ func TestBackend_ECKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
Steps: []logicaltest.TestStep{},
|
Backend: b,
|
||||||
|
Steps: []logicaltest.TestStep{},
|
||||||
}
|
}
|
||||||
|
|
||||||
stepCount = len(testCase.Steps)
|
stepCount = len(testCase.Steps)
|
||||||
@ -120,8 +122,9 @@ func TestBackend_CSRValues(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
Steps: []logicaltest.TestStep{},
|
Backend: b,
|
||||||
|
Steps: []logicaltest.TestStep{},
|
||||||
}
|
}
|
||||||
|
|
||||||
stepCount = len(testCase.Steps)
|
stepCount = len(testCase.Steps)
|
||||||
@ -152,8 +155,9 @@ func TestBackend_URLsCRUD(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
Steps: []logicaltest.TestStep{},
|
Backend: b,
|
||||||
|
Steps: []logicaltest.TestStep{},
|
||||||
}
|
}
|
||||||
|
|
||||||
stepCount = len(testCase.Steps)
|
stepCount = len(testCase.Steps)
|
||||||
@ -187,7 +191,8 @@ func TestBackend_RSARoles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
logicaltest.TestStep{
|
logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
@ -233,7 +238,8 @@ func TestBackend_RSARoles_CSR(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
logicaltest.TestStep{
|
logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
@ -279,7 +285,8 @@ func TestBackend_ECRoles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
logicaltest.TestStep{
|
logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
@ -325,7 +332,8 @@ func TestBackend_ECRoles_CSR(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testCase := logicaltest.TestCase{
|
testCase := logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
logicaltest.TestStep{
|
logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
|
@ -24,8 +24,9 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d1, false),
|
testAccStepConfig(t, d1, false),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -45,8 +46,9 @@ func TestBackend_roleCrud(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d, false),
|
testAccStepConfig(t, d, false),
|
||||||
testAccStepRole(t),
|
testAccStepRole(t),
|
||||||
@ -72,8 +74,9 @@ func TestBackend_configConnection(t *testing.T) {
|
|||||||
d4 := map[string]interface{}{}
|
d4 := map[string]interface{}{}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
AcceptanceTest: true,
|
||||||
Backend: b,
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepConfig(t, d1, false),
|
testAccStepConfig(t, d1, false),
|
||||||
testAccStepConfig(t, d2, false),
|
testAccStepConfig(t, d2, false),
|
||||||
|
@ -99,7 +99,8 @@ func TestSSHBackend_Lookup(t *testing.T) {
|
|||||||
resp3 := []string{testDynamicRoleName, testOTPRoleName}
|
resp3 := []string{testDynamicRoleName, testOTPRoleName}
|
||||||
resp4 := []string{testDynamicRoleName}
|
resp4 := []string{testDynamicRoleName}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testLookupRead(t, data, resp1),
|
testLookupRead(t, data, resp1),
|
||||||
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
||||||
@ -128,7 +129,8 @@ func TestSSHBackend_DynamicKeyCreate(t *testing.T) {
|
|||||||
"ip": testIP,
|
"ip": testIP,
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
||||||
testRoleWrite(t, testDynamicRoleName, testDynamicRoleData),
|
testRoleWrite(t, testDynamicRoleName, testDynamicRoleData),
|
||||||
@ -150,7 +152,8 @@ func TestSSHBackend_OTPRoleCrud(t *testing.T) {
|
|||||||
"cidr_list": testCIDRList,
|
"cidr_list": testCIDRList,
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
||||||
testRoleRead(t, testOTPRoleName, respOTPRoleData),
|
testRoleRead(t, testOTPRoleName, respOTPRoleData),
|
||||||
@ -179,7 +182,8 @@ func TestSSHBackend_DynamicRoleCrud(t *testing.T) {
|
|||||||
"key_type": testDynamicKeyType,
|
"key_type": testDynamicKeyType,
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
||||||
testRoleWrite(t, testDynamicRoleName, testDynamicRoleData),
|
testRoleWrite(t, testDynamicRoleName, testDynamicRoleData),
|
||||||
@ -192,7 +196,8 @@ func TestSSHBackend_DynamicRoleCrud(t *testing.T) {
|
|||||||
|
|
||||||
func TestSSHBackend_NamedKeysCrud(t *testing.T) {
|
func TestSSHBackend_NamedKeysCrud(t *testing.T) {
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
testNamedKeysWrite(t, testKeyName, testSharedPrivateKey),
|
||||||
testNamedKeysDelete(t),
|
testNamedKeysDelete(t),
|
||||||
@ -211,7 +216,8 @@ func TestSSHBackend_OTPCreate(t *testing.T) {
|
|||||||
"ip": testIP,
|
"ip": testIP,
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
||||||
testCredsWrite(t, testOTPRoleName, data, false),
|
testCredsWrite(t, testOTPRoleName, data, false),
|
||||||
@ -227,7 +233,8 @@ func TestSSHBackend_VerifyEcho(t *testing.T) {
|
|||||||
"message": api.VerifyEchoResponse,
|
"message": api.VerifyEchoResponse,
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testVerifyWrite(t, verifyData, expectedData),
|
testVerifyWrite(t, verifyData, expectedData),
|
||||||
},
|
},
|
||||||
@ -264,7 +271,8 @@ func TestSSHBackend_ConfigZeroAddressCRUD(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
testRoleWrite(t, testOTPRoleName, testOTPRoleData),
|
||||||
testConfigZeroAddressWrite(t, req1),
|
testConfigZeroAddressWrite(t, req1),
|
||||||
@ -304,7 +312,8 @@ func TestSSHBackend_CredsForZeroAddressRoles(t *testing.T) {
|
|||||||
"roles": fmt.Sprintf("%s,%s", testOTPRoleName, testDynamicRoleName),
|
"roles": fmt.Sprintf("%s,%s", testOTPRoleName, testDynamicRoleName),
|
||||||
}
|
}
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: testingFactory,
|
AcceptanceTest: true,
|
||||||
|
Factory: testingFactory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testRoleWrite(t, testOTPRoleName, otpRoleData),
|
testRoleWrite(t, testOTPRoleName, otpRoleData),
|
||||||
testCredsWrite(t, testOTPRoleName, data, true),
|
testCredsWrite(t, testOTPRoleName, data, true),
|
||||||
|
@ -24,7 +24,8 @@ const (
|
|||||||
func TestBackend_basic(t *testing.T) {
|
func TestBackend_basic(t *testing.T) {
|
||||||
decryptData := make(map[string]interface{})
|
decryptData := make(map[string]interface{})
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", false),
|
testAccStepWritePolicy(t, "test", false),
|
||||||
testAccStepReadPolicy(t, "test", false, false),
|
testAccStepReadPolicy(t, "test", false, false),
|
||||||
@ -47,7 +48,8 @@ func TestBackend_basic(t *testing.T) {
|
|||||||
func TestBackend_upsert(t *testing.T) {
|
func TestBackend_upsert(t *testing.T) {
|
||||||
decryptData := make(map[string]interface{})
|
decryptData := make(map[string]interface{})
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepReadPolicy(t, "test", true, false),
|
testAccStepReadPolicy(t, "test", true, false),
|
||||||
testAccStepEncryptUpsert(t, "test", testPlaintext, decryptData),
|
testAccStepEncryptUpsert(t, "test", testPlaintext, decryptData),
|
||||||
@ -60,7 +62,8 @@ func TestBackend_upsert(t *testing.T) {
|
|||||||
func TestBackend_datakey(t *testing.T) {
|
func TestBackend_datakey(t *testing.T) {
|
||||||
dataKeyInfo := make(map[string]interface{})
|
dataKeyInfo := make(map[string]interface{})
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", false),
|
testAccStepWritePolicy(t, "test", false),
|
||||||
testAccStepReadPolicy(t, "test", false, false),
|
testAccStepReadPolicy(t, "test", false, false),
|
||||||
@ -75,7 +78,8 @@ func TestBackend_rotation(t *testing.T) {
|
|||||||
decryptData := make(map[string]interface{})
|
decryptData := make(map[string]interface{})
|
||||||
encryptHistory := make(map[int]map[string]interface{})
|
encryptHistory := make(map[int]map[string]interface{})
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", false),
|
testAccStepWritePolicy(t, "test", false),
|
||||||
testAccStepEncryptVX(t, "test", testPlaintext, decryptData, 0, encryptHistory),
|
testAccStepEncryptVX(t, "test", testPlaintext, decryptData, 0, encryptHistory),
|
||||||
@ -132,7 +136,8 @@ func TestBackend_rotation(t *testing.T) {
|
|||||||
func TestBackend_basic_derived(t *testing.T) {
|
func TestBackend_basic_derived(t *testing.T) {
|
||||||
decryptData := make(map[string]interface{})
|
decryptData := make(map[string]interface{})
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Factory: Factory,
|
AcceptanceTest: true,
|
||||||
|
Factory: Factory,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepWritePolicy(t, "test", true),
|
testAccStepWritePolicy(t, "test", true),
|
||||||
testAccStepReadPolicy(t, "test", false, true),
|
testAccStepReadPolicy(t, "test", false, true),
|
||||||
|
@ -4,8 +4,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/vault/logical"
|
"github.com/hashicorp/vault/logical"
|
||||||
logicaltest "github.com/hashicorp/vault/logical/testing"
|
|
||||||
"github.com/hashicorp/vault/logical/framework"
|
"github.com/hashicorp/vault/logical/framework"
|
||||||
|
logicaltest "github.com/hashicorp/vault/logical/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MakeTestBackend creates a simple MFA enabled backend.
|
// MakeTestBackend creates a simple MFA enabled backend.
|
||||||
@ -28,12 +28,12 @@ func MakeTestBackend() *framework.Backend {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func testPathLogin() *framework.Path {
|
func testPathLogin() *framework.Path {
|
||||||
return &framework.Path{
|
return &framework.Path{
|
||||||
Pattern: `login`,
|
Pattern: `login`,
|
||||||
Fields: map[string]*framework.FieldSchema{
|
Fields: map[string]*framework.FieldSchema{
|
||||||
"username": &framework.FieldSchema{
|
"username": &framework.FieldSchema{
|
||||||
Type: framework.TypeString,
|
Type: framework.TypeString,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -70,7 +70,8 @@ func TestMFALogin(t *testing.T) {
|
|||||||
b := MakeTestBackend()
|
b := MakeTestBackend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepEnableMFA(t),
|
testAccStepEnableMFA(t),
|
||||||
testAccStepLogin(t, "user"),
|
testAccStepLogin(t, "user"),
|
||||||
@ -82,7 +83,8 @@ func TestMFALoginDenied(t *testing.T) {
|
|||||||
b := MakeTestBackend()
|
b := MakeTestBackend()
|
||||||
|
|
||||||
logicaltest.Test(t, logicaltest.TestCase{
|
logicaltest.Test(t, logicaltest.TestCase{
|
||||||
Backend: b,
|
AcceptanceTest: true,
|
||||||
|
Backend: b,
|
||||||
Steps: []logicaltest.TestStep{
|
Steps: []logicaltest.TestStep{
|
||||||
testAccStepEnableMFA(t),
|
testAccStepEnableMFA(t),
|
||||||
testAccStepLoginDenied(t, "user"),
|
testAccStepLoginDenied(t, "user"),
|
||||||
@ -93,7 +95,7 @@ func TestMFALoginDenied(t *testing.T) {
|
|||||||
func testAccStepEnableMFA(t *testing.T) logicaltest.TestStep {
|
func testAccStepEnableMFA(t *testing.T) logicaltest.TestStep {
|
||||||
return logicaltest.TestStep{
|
return logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
Path: "mfa_config",
|
Path: "mfa_config",
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"type": "test",
|
"type": "test",
|
||||||
},
|
},
|
||||||
@ -103,25 +105,25 @@ func testAccStepEnableMFA(t *testing.T) logicaltest.TestStep {
|
|||||||
func testAccStepLogin(t *testing.T, username string) logicaltest.TestStep {
|
func testAccStepLogin(t *testing.T, username string) logicaltest.TestStep {
|
||||||
return logicaltest.TestStep{
|
return logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
Path: "login",
|
Path: "login",
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"method": "accept",
|
"method": "accept",
|
||||||
"username": username,
|
"username": username,
|
||||||
},
|
},
|
||||||
Unauthenticated: true,
|
Unauthenticated: true,
|
||||||
Check: logicaltest.TestCheckAuth([]string{"foo"}),
|
Check: logicaltest.TestCheckAuth([]string{"foo"}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccStepLoginDenied(t *testing.T, username string) logicaltest.TestStep {
|
func testAccStepLoginDenied(t *testing.T, username string) logicaltest.TestStep {
|
||||||
return logicaltest.TestStep{
|
return logicaltest.TestStep{
|
||||||
Operation: logical.UpdateOperation,
|
Operation: logical.UpdateOperation,
|
||||||
Path: "login",
|
Path: "login",
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"method": "deny",
|
"method": "deny",
|
||||||
"username": username,
|
"username": username,
|
||||||
},
|
},
|
||||||
Unauthenticated: true,
|
Unauthenticated: true,
|
||||||
Check: logicaltest.TestCheckError(),
|
Check: logicaltest.TestCheckError(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,11 @@ type TestCase struct {
|
|||||||
// in the case that the test can't guarantee all resources were
|
// in the case that the test can't guarantee all resources were
|
||||||
// properly cleaned up.
|
// properly cleaned up.
|
||||||
Teardown TestTeardownFunc
|
Teardown TestTeardownFunc
|
||||||
|
|
||||||
|
// AcceptanceTest, if set, the test case will be run only if
|
||||||
|
// the environment variable TF_ACC is set. If not this test case
|
||||||
|
// will be run as a unit test.
|
||||||
|
AcceptanceTest bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestStep is a single step within a TestCase.
|
// TestStep is a single step within a TestCase.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user