Skip to content

Commit

Permalink
DO NOT MERGE Hack to run name constraints provider tests with a dev b…
Browse files Browse the repository at this point in the history
…uild of Vault.
  • Loading branch information
victorr committed Jan 28, 2025
1 parent 3aa6b7d commit 29254a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion vault/resource_pki_secret_backend_root_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func pkiSecretBackendRootCertCreate(_ context.Context, d *schema.ResourceData, m
// Whether name constraints fields (other than permitted_dns_domains), are supproted,
// See VAULT-32141.
isNameConstraintsExtensionSupported := provider.IsAPISupported(meta, provider.VaultVersion119)
if isNameConstraintsExtensionSupported {
if isNameConstraintsExtensionSupported || true { // FIXME(victorr): remove dev workaround
rootCertStringArrayFields = append(rootCertStringArrayFields,
consts.FieldExcludedDNSDomains,
consts.FieldPermittedIPRanges,
Expand Down
10 changes: 6 additions & 4 deletions vault/resource_pki_secret_backend_root_cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ func TestPkiSecretBackendRootCertificate_basic(t *testing.T) {
// TestPkiSecretBackendRootCertificate_name_constraints is just like TestPkiSecretBackendRootCertificate_basic,
// but it uses the permitted_/excluded_ parameters for the name constraints extension.
func TestPkiSecretBackendRootCertificate_name_constraints(t *testing.T) {
meta := testProvider.Meta().(*provider.ProviderMeta)
if !meta.IsAPISupported(provider.VaultVersion119) {
t.Skip("requires Vault 1.19+")
}
//meta := testProvider.Meta().(*provider.ProviderMeta)
//if !meta.IsAPISupported(provider.VaultVersion119) {
// t.Skip("requires Vault 1.19+")
//} // FIXME(victorr): DO NOT COMMIT

path := "pki-" + strconv.Itoa(acctest.RandInt())
config := testPkiSecretBackendRootCertificateConfig_name_constraints(path)
Expand Down Expand Up @@ -155,6 +155,8 @@ func checkCertificateNameConstraints(resourceName string, s *terraform.State) er
check(consts.FieldPermittedURIDomains, cert.PermittedURIDomains, "https://example.com", "https://www.example.com")
check(consts.FieldExcludedURIDomains, cert.ExcludedURIDomains, "ftp://example.com")

failedChecks = append(failedChecks, errors.New("REALITY CHECK: TEST IS RUNNING"))

return errors.Join(failedChecks...)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func pkiSecretBackendRootSignIntermediateCreate(ctx context.Context, d *schema.R
// Whether name constraints fields (other than permitted_dns_domains), are supproted,
// See VAULT-32141.
isNameConstraintsExtensionSupported := provider.IsAPISupported(meta, provider.VaultVersion119)
if isNameConstraintsExtensionSupported {
if isNameConstraintsExtensionSupported || true { // FIXME(victorr): remove dev workaround
intermediateSignStringArrayFields = append(intermediateSignStringArrayFields,
consts.FieldExcludedDNSDomains,
consts.FieldPermittedIPRanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ func TestPkiSecretBackendRootSignIntermediate_basic_pem_bundle(t *testing.T) {
}

func TestPkiSecretBackendRootSignIntermediate_name_constraints_pem_bundle(t *testing.T) {
meta := testProvider.Meta().(*provider.ProviderMeta)
if !meta.IsAPISupported(provider.VaultVersion119) {
t.Skip("requires Vault 1.19+")
}
//meta := testProvider.Meta().(*provider.ProviderMeta)
//if !meta.IsAPISupported(provider.VaultVersion119) {
// t.Skip("requires Vault 1.19+")
//} // FIXME(victorr): DO NOT COMMIT

rootPath := "pki-root-" + strconv.Itoa(acctest.RandInt())
intermediatePath := "pki-intermediate-" + strconv.Itoa(acctest.RandInt())
Expand Down

0 comments on commit 29254a0

Please sign in to comment.