Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update go mod #366

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/functional/dive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"

dive "github.com/HugoByte/DIVE/test/functional"
dive "github.com/hugobyte/dive/test/functional"
)

// To Print cli output to console
Expand Down
20 changes: 10 additions & 10 deletions test/functional/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/HugoByte/DIVE/test/functional
module github.com/hugobyte/dive/test/functional

go 1.21.4

require (
github.com/google/uuid v1.6.0
github.com/hugobyte/dive-core/cli v0.0.0-20240117101917-8ee8b4124677
github.com/hugobyte/dive/cli v0.0.0-20240221033343-40fba2434097
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.1
)
Expand All @@ -28,10 +28,10 @@ require (
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kurtosis-tech/kurtosis-portal/api/golang v0.0.0-20231031173452-349f1ec9a443 // indirect
github.com/kurtosis-tech/kurtosis/api/golang v0.86.6 // indirect
github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240116202251-69c57ec4384a // indirect
github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240116202251-69c57ec4384a // indirect
github.com/kurtosis-tech/kurtosis/utils v0.0.0-20240116202251-69c57ec4384a // indirect
github.com/kurtosis-tech/kurtosis/api/golang v0.86.10 // indirect
github.com/kurtosis-tech/kurtosis/contexts-config-store v0.0.0-20240124210655-a35e0a2cee4b // indirect
github.com/kurtosis-tech/kurtosis/grpc-file-transfer/golang v0.0.0-20240124210655-a35e0a2cee4b // indirect
github.com/kurtosis-tech/kurtosis/utils v0.0.0-20240124210655-a35e0a2cee4b // indirect
github.com/kurtosis-tech/stacktrace v0.0.0-20211028211901-1c67a77b5409 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand All @@ -54,10 +54,10 @@ require (
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
161 changes: 78 additions & 83 deletions test/functional/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/google/uuid"
"github.com/onsi/gomega"
"os"
"os/exec"
"path/filepath"
"sync"

//"github.com/hugobyte/dive-core/cli/common"
"github.com/google/uuid"
"github.com/onsi/gomega"
)

type NodeInfo struct {
Expand Down Expand Up @@ -150,7 +149,7 @@ func RunCustomNeutronNode1(enclaveName string) {
func RunCustomNeutronNode0(enclaveName string) {
cmd := GetBinaryCommand()
//updated_path2 := UpdateNeutronPublicPorts(NEUTRON_CONFIG0)
cmd.Args = append(cmd.Args, "chain", "neutron", "-c",NEUTRON_CONFIG0 , "--enclaveName", enclaveName)
cmd.Args = append(cmd.Args, "chain", "neutron", "-c", NEUTRON_CONFIG0, "--enclaveName", enclaveName)
err := cmd.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}
Expand Down Expand Up @@ -178,7 +177,7 @@ func RunHardhatNode(enclaveName string) {

func RunDecentralizedCustomIconNode0(enclaveName string) {
cmd := GetBinaryCommand()
cmd.Args = append(cmd.Args, "chain", "icon", "-c",ICON_CONFIG0 , "-g", ICON_GENESIS0, "-d", "--enclaveName", enclaveName)
cmd.Args = append(cmd.Args, "chain", "icon", "-c", ICON_CONFIG0, "-g", ICON_GENESIS0, "-d", "--enclaveName", enclaveName)
err := cmd.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}
Expand Down Expand Up @@ -211,43 +210,43 @@ func GetServiceDetails(servicesJson string, service string) (serviceName string,
}

func UpdateRelayChain(filePath, newChainType, newRelayChainName, enclaveName string, newNodeType1, newNodeType2 string, relayChain string) string {
mutex.Lock()
defer mutex.Unlock()

fileContent, err := os.ReadFile(filePath)
if err != nil {
panic(err)
}

var local Configuration1
err = json.Unmarshal(fileContent, &local)
if err != nil {
panic(err)
}

// Update ChainType and RelayChain Name
local.ChainType = newChainType
local.RelayChain.Name = newRelayChainName

// Update NodeType for RelayChain Nodes
for i := range local.RelayChain.Nodes {
if i%2 == 0 {
local.RelayChain.Nodes[i].NodeType = newNodeType1
} else {
local.RelayChain.Nodes[i].NodeType = newNodeType2
}
}

// Update Prometheus for Para Nodes
for i := range local.Parachains {
if relayChain == "kusama"{
mutex.Lock()
defer mutex.Unlock()

fileContent, err := os.ReadFile(filePath)
if err != nil {
panic(err)
}

var local Configuration1
err = json.Unmarshal(fileContent, &local)
if err != nil {
panic(err)
}

// Update ChainType and RelayChain Name
local.ChainType = newChainType
local.RelayChain.Name = newRelayChainName

// Update NodeType for RelayChain Nodes
for i := range local.RelayChain.Nodes {
if i%2 == 0 {
local.RelayChain.Nodes[i].NodeType = newNodeType1
} else {
local.RelayChain.Nodes[i].NodeType = newNodeType2
}
}

// Update Prometheus for Para Nodes
for i := range local.Parachains {
if relayChain == "kusama" {
local.Parachains[i].Name = "karura"
} else {
local.Parachains[i].Name = "acala"
}
}
}

// Remove content inside RelayChain
// Remove content inside RelayChain
local.Parachains = []struct {
Name string `json:"name"`
Nodes []struct {
Expand All @@ -257,29 +256,26 @@ func UpdateRelayChain(filePath, newChainType, newRelayChainName, enclaveName str
} `json:"nodes"`
}{}

updatedJSON, err := json.MarshalIndent(local, "", " ")
if err != nil {
panic(err)
}

updatedJSON, err := json.MarshalIndent(local, "", " ")
if err != nil {
panic(err)
}

tmpfilePath := fmt.Sprintf("updated-config-%s.json", enclaveName)
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}
defer tmpfile.Close()
tmpfilePath := fmt.Sprintf("updated-config-%s.json", enclaveName)
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}
defer tmpfile.Close()

_, err = tmpfile.Write(updatedJSON)
if err != nil {
panic(err)
}
_, err = tmpfile.Write(updatedJSON)
if err != nil {
panic(err)
}

return tmpfile.Name()
return tmpfile.Name()
}



func UpdateParaChain(filePath, newChainType, newParaName string) string {
mutex.Lock()
defer mutex.Unlock()
Expand All @@ -294,7 +290,7 @@ func UpdateParaChain(filePath, newChainType, newParaName string) string {
if err != nil {
panic(err)
}
//update chain type
//update chain type
local.ChainType = newChainType
// Remove content inside RelayChain
local.RelayChain = struct {
Expand All @@ -316,12 +312,11 @@ func UpdateParaChain(filePath, newChainType, newParaName string) string {
panic(err)
}


tmpfilePath := fmt.Sprintf("updated-local.json")
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}
tmpfilePath := fmt.Sprintf("updated-local.json")
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}

defer tmpfile.Close()

Expand All @@ -333,7 +328,7 @@ func UpdateParaChain(filePath, newChainType, newParaName string) string {
return tmpfile.Name()
}

func UpdateChainInfo(filePath, newChainType, newRelayChainName, newParaName string,newNodeType1,newNodeType2 string) string {
func UpdateChainInfo(filePath, newChainType, newRelayChainName, newParaName string, newNodeType1, newNodeType2 string) string {
mutex.Lock()
defer mutex.Unlock()

Expand All @@ -355,27 +350,27 @@ func UpdateChainInfo(filePath, newChainType, newRelayChainName, newParaName stri
// Update Name and Prometheus for Para Nodes
for i := range local.Parachains {
local.Parachains[i].Name = newParaName


}
// Update NodeType for RelayChain Nodes
for i := range local.RelayChain.Nodes {
if i%2 == 0 {
local.RelayChain.Nodes[i].NodeType = newNodeType1
} else {
local.RelayChain.Nodes[i].NodeType = newNodeType2
}
}
// Update NodeType for RelayChain Nodes
for i := range local.RelayChain.Nodes {
if i%2 == 0 {
local.RelayChain.Nodes[i].NodeType = newNodeType1
} else {
local.RelayChain.Nodes[i].NodeType = newNodeType2
}
}

updatedJSON, err := json.MarshalIndent(local, "", " ")
if err != nil {
panic(err)
}

tmpfilePath := fmt.Sprintf("updated-local.json")
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}
tmpfile, err := os.Create(tmpfilePath)
if err != nil {
panic(err)
}

defer tmpfile.Close()

Expand All @@ -386,11 +381,11 @@ func UpdateChainInfo(filePath, newChainType, newRelayChainName, newParaName stri

return tmpfile.Name()
}
func CheckInvalidTestnet(selectedParaChain string, invalidParaChainlist []string)bool{
for _, paraChainName := range invalidParaChainlist {
if selectedParaChain == paraChainName {
return true
}
func CheckInvalidTestnet(selectedParaChain string, invalidParaChainlist []string) bool {
for _, paraChainName := range invalidParaChainlist {
if selectedParaChain == paraChainName {
return true
}
return false
}
}
return false
}
Loading