Skip to content

Commit

Permalink
Merge pull request #84 from kaleido-io/fix-examples
Browse files Browse the repository at this point in the history
Fix network types in examples
  • Loading branch information
lanasta authored Dec 4, 2024
2 parents a11af38 + 46e7166 commit d9304c5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/platform_stack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "kaleido_platform_stack" "digital_asset_manager_stack" {
}

resource "kaleido_platform_network" "net_0" {
type = "Besu"
type = "BesuNetwork"
name = "evmchain1"
environment = kaleido_platform_environment.env_0.id
config_json = jsonencode({
Expand Down
4 changes: 2 additions & 2 deletions examples/platform_stack_multiparty_sandbox/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "kaleido_platform_environment" "env_0" {
}

resource "kaleido_platform_network" "net_0" {
type = "Besu"
type = "BesuNetwork"
name = "evmchain1"
environment = kaleido_platform_environment.env_0.id
config_json = jsonencode({
Expand Down Expand Up @@ -53,7 +53,7 @@ resource "kaleido_platform_service" "bns" {
}

resource "kaleido_platform_network" "net_ipfs" {
type = "IPFS"
type = "IPFSNetwork"
name = "${var.environment_name}_ipfs"
environment = kaleido_platform_environment.env_0.id
config_json = jsonencode({})
Expand Down
4 changes: 2 additions & 2 deletions examples/platform_stack_two_env_besu_network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resource "kaleido_platform_environment" "env_og" {

resource "kaleido_platform_network" "net_og" {
provider = kaleido.originator
type = "Besu"
type = "BesuNetwork"
name = var.originator_name
environment = kaleido_platform_environment.env_og.id
init_mode = "automated"
Expand Down Expand Up @@ -150,7 +150,7 @@ resource "kaleido_platform_environment" "env_sec" {

resource "kaleido_platform_network" "net_sec" {
provider = kaleido.secondary
type = "Besu"
type = "BesuNetwork"
name = var.secondary_name
environment = kaleido_platform_environment.env_sec.id
init_mode = "manual"
Expand Down
10 changes: 5 additions & 5 deletions kaleido/platform/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
var networkStep1 = `
resource "kaleido_platform_network" "network1" {
environment = "env1"
type = "besu"
type = "BesuNetwork"
name = "network1"
config_json = jsonencode({
"setting1": "value1"
Expand All @@ -42,7 +42,7 @@ resource "kaleido_platform_network" "network1" {
var networkStep2 = `
resource "kaleido_platform_network" "network1" {
environment = "env1"
type = "besu"
type = "BesuNetwork"
name = "network1"
config_json = jsonencode({
"setting1": "value1",
Expand Down Expand Up @@ -82,7 +82,7 @@ func TestNetwork1(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(network1Resource, "id"),
resource.TestCheckResourceAttr(network1Resource, "name", `network1`),
resource.TestCheckResourceAttr(network1Resource, "type", `besu`),
resource.TestCheckResourceAttr(network1Resource, "type", `BesuNetwork`),
resource.TestCheckResourceAttr(network1Resource, "config_json", `{"setting1":"value1"}`),
),
},
Expand All @@ -91,7 +91,7 @@ func TestNetwork1(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(network1Resource, "id"),
resource.TestCheckResourceAttr(network1Resource, "name", `network1`),
resource.TestCheckResourceAttr(network1Resource, "type", `besu`),
resource.TestCheckResourceAttr(network1Resource, "type", `BesuNetwork`),
resource.TestCheckResourceAttr(network1Resource, "config_json", `{"setting1":"value1","setting2":"value2"}`),
resource.TestCheckResourceAttr(network1Resource, "info.setting1", `value1`),
resource.TestCheckResourceAttr(network1Resource, "info.setting2", `value2`),
Expand All @@ -104,7 +104,7 @@ func TestNetwork1(t *testing.T) {
"id": "%[1]s",
"created": "%[2]s",
"updated": "%[3]s",
"type": "besu",
"type": "BesuNetwork",
"name": "network1",
"config": {
"setting1": "value1",
Expand Down
12 changes: 6 additions & 6 deletions kaleido/platform/stacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "kaleido_platform_stack" "stack1" {
name = "stack1"
type = "chain_infrastructure"
environment = "env1"
network_type = "besu"
network_type = "BesuNetwork"
}
`

Expand All @@ -42,7 +42,7 @@ resource "kaleido_platform_stack" "stack1" {
name = "stack1_renamed"
type = "chain_infrastructure"
environment = "env1"
network_type = "besu"
network_type = "BesuNetwork"
}
`

Expand Down Expand Up @@ -73,7 +73,7 @@ func TestStacks1(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(Stack1Resource, "id"),
resource.TestCheckResourceAttr(Stack1Resource, "name", `stack1`),
resource.TestCheckResourceAttr(Stack1Resource, "network_type", `besu`),
resource.TestCheckResourceAttr(Stack1Resource, "network_type", `BesuNetwork`),
resource.TestCheckResourceAttr(Stack1Resource, "type", `chain_infrastructure`),
),
},
Expand All @@ -82,7 +82,7 @@ func TestStacks1(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(Stack1Resource, "id"),
resource.TestCheckResourceAttr(Stack1Resource, "name", `stack1_renamed`),
resource.TestCheckResourceAttr(Stack1Resource, "network_type", `besu`),
resource.TestCheckResourceAttr(Stack1Resource, "network_type", `BesuNetwork`),
resource.TestCheckResourceAttr(Stack1Resource, "type", `chain_infrastructure`),
func(s *terraform.State) error {
// Compare the final result on the mock-server side
Expand All @@ -95,7 +95,7 @@ func TestStacks1(t *testing.T) {
"updated": "%[3]s",
"type": "chain_infrastructure",
"name": "stack1_renamed",
"networkType": "besu",
"networkType": "BesuNetwork",
"environmentMemberId": "%[4]s"
}
`,
Expand Down Expand Up @@ -131,7 +131,7 @@ func (mp *mockPlatform) postStacks(res http.ResponseWriter, req *http.Request) {
rt.Updated = &now
rt.EnvironmentMemberID = nanoid.New()
if rt.NetworkType == "" {
rt.NetworkType = "besu"
rt.NetworkType = "BesuNetwork"
}
mp.stacks[mux.Vars(req)["env"]+"/"+rt.ID] = &rt
mp.respond(res, &rt, 201)
Expand Down

0 comments on commit d9304c5

Please sign in to comment.