-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
* add Link config, init, and capabilities * add node status proto * bump protoc version to 3.21.9 * make proto * adding link tests * remove wrapped link * add changelog entry * update changelog entry
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
hcp/connectivity: Add foundational OSS support for opt-in secure communication between self-managed Vault nodes and [HashiCorp Cloud Platform](https://cloud.hashicorp.com) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package server | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-test/deep" | ||
sdkResource "github.com/hashicorp/hcp-sdk-go/resource" | ||
"github.com/hashicorp/vault/internalshared/configutil" | ||
) | ||
|
||
func TestHCPLinkConfig(t *testing.T) { | ||
config, err := LoadConfigFile("./test-fixtures/hcp_link_config.hcl") | ||
if err != nil { | ||
t.Fatalf("err: %s", err) | ||
} | ||
resIDRaw := "organization/bc58b3d0-2eab-4ab8-abf4-f61d3c9975ff/project/1c78e888-2142-4000-8918-f933bbbc7690/hashicorp.example.resource/example" | ||
res, _ := sdkResource.FromString(resIDRaw) | ||
|
||
expected := &Config{ | ||
Storage: &Storage{ | ||
Type: "inmem", | ||
Config: map[string]string{}, | ||
}, | ||
SharedConfig: &configutil.SharedConfig{ | ||
Listeners: []*configutil.Listener{ | ||
{ | ||
Type: "tcp", | ||
Address: "127.0.0.1:8200", | ||
TLSDisable: true, | ||
CustomResponseHeaders: DefaultCustomHeaders, | ||
}, | ||
}, | ||
HCPLinkConf: &configutil.HCPLinkConfig{ | ||
ResourceIDRaw: resIDRaw, | ||
Resource: &res, | ||
ClientID: "J2TtcSYOyPUkPV2z0mSyDtvitxLVjJmu", | ||
ClientSecret: "N9JtHZyOnHrIvJZs82pqa54vd4jnkyU3xCcqhFXuQKJZZuxqxxbP1xCfBZVB82vY", | ||
}, | ||
DisableMlock: true, | ||
}, | ||
} | ||
|
||
config.Prune() | ||
if diff := deep.Equal(config, expected); diff != nil { | ||
t.Fatal(diff) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
storage "inmem" {} | ||
listener "tcp" { | ||
address = "127.0.0.1:8200" | ||
tls_disable = true | ||
} | ||
cloud { | ||
resource_id = "organization/bc58b3d0-2eab-4ab8-abf4-f61d3c9975ff/project/1c78e888-2142-4000-8918-f933bbbc7690/hashicorp.example.resource/example" | ||
client_id = "J2TtcSYOyPUkPV2z0mSyDtvitxLVjJmu" | ||
client_secret = "N9JtHZyOnHrIvJZs82pqa54vd4jnkyU3xCcqhFXuQKJZZuxqxxbP1xCfBZVB82vY" | ||
} | ||
disable_mlock = true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package hcp_link | ||
|
||
import ( | ||
"testing" | ||
|
||
scada "github.com/hashicorp/hcp-scada-provider" | ||
"github.com/hashicorp/vault/vault" | ||
) | ||
|
||
func TestHCPLinkConnected(t *testing.T) { | ||
t.Parallel() | ||
cluster := getTestCluster(t, 2) | ||
defer cluster.Cleanup() | ||
|
||
vaultHCPLink, _ := TestClusterWithHCPLinkEnabled(t, cluster, false, false) | ||
defer vaultHCPLink.Cleanup() | ||
|
||
for _, core := range cluster.Cores { | ||
checkLinkStatus(core.Client, scada.SessionStatusConnected, t) | ||
} | ||
} | ||
|
||
func TestHCPLinkNotConfigured(t *testing.T) { | ||
t.Parallel() | ||
cluster := getTestCluster(t, 2) | ||
defer cluster.Cleanup() | ||
|
||
cluster.Start() | ||
core := cluster.Cores[0].Core | ||
vault.TestWaitActive(t, core) | ||
|
||
for _, core := range cluster.Cores { | ||
checkLinkStatus(core.Client, "", t) | ||
} | ||
} |