Skip to content

Commit

Permalink
Merge pull request #129 from HugoByte/DV-27-Update-github-actions
Browse files Browse the repository at this point in the history
refactor: refactoring github actions
  • Loading branch information
shreyasbhat0 authored Jan 19, 2024
2 parents eaa4784 + 4fb0124 commit fe1d0ca
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Running All Relay and Parachain command tests
run: |
cd test && make run-relay&parachain-all
cd test && make run-relay-parachain-all
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Running Kusama Relay and Parachain command tests
run: |
cd test && make run-relay&parachain-kusama
cd test && make run-relay-parachain-kusama
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Running Polkadot Relay and Parachain command tests
run: |
cd test && make run-relay&parachain-polkadot
cd test && make run-relay-parachain-polkadot
24 changes: 12 additions & 12 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,39 +62,39 @@ run-archway: BINARY

run-relaychain-kusama: BINARY
@echo "Running relaychain chain commands test cases for kusama"
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Relaychain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Relaychain commands" -v -p -timeout=3h

run-relaychain-polkadot: BINARY
@echo "Running relaychain chain commands test cases for polkadot"
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Relaychain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Relaychain commands" -v -p -timeout=3h

run-relaychain-all: BINARY
@echo "Running relaychain chain commands test cases for polkadot and kusama"
@cd $(CURDIR)/functional && ginkgo --focus="Relaychain commands" -v -timeout=3h
@cd $(CURDIR)/functional && ginkgo --focus="Relaychain commands" -v -p -timeout=3h

run-parachain-kusama: BINARY
@echo "Running parachain chain commands test cases for kusama"
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Parachain commands" -v -p -timeout=3h

run-parachain-polkadot: BINARY
@echo "Running parachain chain commands test cases for polkadot"
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Parachain commands" -v -p -timeout=3h

run-parachain-all: BINARY
@echo "Running parachain chain commands test cases for polkadot and kusama"
@cd $(CURDIR)/functional && ginkgo --focus="Parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && ginkgo --focus="Parachain commands" -v -p -timeout=3h

run-relay&parachain-kusama: BINARY
run-relay-parachain-kusama: BINARY
@echo "Running relay and parachain chain commands test cases for kusama and its parachains"
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Relaychain and parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=kusama ginkgo --focus="Relaychain and parachain commands" -v -p -timeout=3h

run-relay&parachain-polkadot: BINARY
run-relay-parachain-polkadot: BINARY
@echo "Running relay and parachain chain commands test cases for polkadot and its parachains"
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Relaychain and parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && relayChain=polkadot ginkgo --focus="Relaychain and parachain commands" -v -p -timeout=3h

run-relay&parachain-all: BINARY
run-relay-parachain-all: BINARY
@echo "Running relay and parachain chain commands test cases for polkadot and kusama along its respective parachains"
@cd $(CURDIR)/functional && ginkgo --focus="Relaychain and parachain commands" -v -timeout=3h
@cd $(CURDIR)/functional && ginkgo --focus="Relaychain and parachain commands" -v -p -timeout=3h

run-misc: BINARY
@echo "Running other test cases"
Expand Down
62 changes: 33 additions & 29 deletions test/functional/dive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"os"
"os/exec"
"path/filepath"
"testing"

"github.com/hugobyte/dive-core/cli/cmd/utility"
Expand Down Expand Up @@ -129,8 +130,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should start bridge between icon and eth by running icon node first and then decentralising it", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)

serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
dive.DecentralizeCustomIconNode(nid0, endpoint0, serviceName0, enclaveName)

dive.RunEthNode(enclaveName)
Expand All @@ -146,7 +147,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
enclaveName := dive.GenerateRandomName()

dive.RunIconNode(enclaveName)
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
dive.DecentralizeCustomIconNode(nid0, endpoint0, serviceName0, enclaveName)

dive.RunHardhatNode(enclaveName)
Expand All @@ -171,8 +173,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
enclaveName := dive.GenerateRandomName()
dive.RunDecentralizedIconNode(enclaveName)
dive.RunCustomIconNode1(enclaveName)

serviceName, endpoint, nid := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG1_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName, endpoint, nid := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG1_SERVICENAME)
dive.DecentralizeCustomIconNode(nid, endpoint, serviceName, enclaveName)

cmd.Args = append(cmd.Args, "bridge", "btp", "--chainA", "icon", "--chainB", "icon", "--chainAServiceName", dive.ICON_CONFIG0_SERVICENAME, "--chainBServiceName", dive.ICON_CONFIG1_SERVICENAME, "--enclaveName", enclaveName)
Expand All @@ -186,11 +188,11 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
dive.RunCustomIconNode1(enclaveName)

serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path0, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path0[0], dive.ICON_CONFIG0_SERVICENAME)
dive.DecentralizeCustomIconNode(nid0, endpoint0, serviceName0, enclaveName)

serviceName1, endpoint1, nid1 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG1_SERVICENAME)
service_path1, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName1, endpoint1, nid1 := dive.GetServiceDetails(service_path1[0], dive.ICON_CONFIG1_SERVICENAME)
dive.DecentralizeCustomIconNode(nid1, endpoint1, serviceName1, enclaveName)

cmd.Args = append(cmd.Args, "bridge", "btp", "--chainA", "icon", "--chainB", "icon", "--chainAServiceName", dive.ICON_CONFIG0_SERVICENAME, "--chainBServiceName", dive.ICON_CONFIG1_SERVICENAME, "--enclaveName", enclaveName)
Expand All @@ -214,11 +216,11 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
enclaveName := dive.GenerateRandomName()
dive.RunCustomIconNode0(enclaveName)
dive.RunCustomIconNode1(enclaveName)

serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path0, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path0[0], dive.ICON_CONFIG0_SERVICENAME)
dive.DecentralizeCustomIconNode(nid0, endpoint0, serviceName0, enclaveName)

serviceName1, endpoint1, nid1 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG1_SERVICENAME)
service_path1, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName1, endpoint1, nid1 := dive.GetServiceDetails(service_path1[0], dive.ICON_CONFIG1_SERVICENAME)
dive.DecentralizeCustomIconNode(nid1, endpoint1, serviceName1, enclaveName)

cmd.Args = append(cmd.Args, "bridge", "btp", "--chainA", "icon", "--chainB", "icon", "--chainAServiceName", dive.ICON_CONFIG0_SERVICENAME, "--chainBServiceName", dive.ICON_CONFIG1_SERVICENAME, "--enclaveName", enclaveName)
Expand All @@ -242,23 +244,20 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for bridge command", func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "bridge", "btp", "--chainA", "icon", "--chainB", "invalid_input", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
})

ginkgo.It("should handle invalid input for bridge command", func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "bridge", "btp", "--chainA", "invalid_input", "--chainB", "eth", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
})

ginkgo.It("should handle invalid input ibc bridge command", func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "bridge", "ibc", "--chainA", "archway", "--chainB", "invalid", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
})
Expand Down Expand Up @@ -565,7 +564,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should run icon node first and then decentralise it", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path[0] , dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "gochain", "-k", "keystores/keystore.json", "-n", nid0, "-e", endpoint0, "-s", serviceName0, "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand All @@ -590,7 +590,7 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {

ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "chain", "icon", "-c", "../../cli/sample-jsons/invalid_config.json", "-g", "./config/invalid-icon-3.zip", "--enclaveName", enclaveName)
cmd.Args = append(cmd.Args, "chain", "icon", "-c", "invalid_config.json", "-g", "./config/invalid-icon-3.zip", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
Expand All @@ -599,7 +599,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "invalidPassword", "-k", "keystores/keystore.json", "-n", nid0, "-e", endpoint0, "-s", serviceName0, "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand All @@ -609,7 +610,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "gochain", "-k", "keystores/invalid.json", "-n", nid0, "-e", endpoint0, "-s", serviceName0, "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand All @@ -619,7 +621,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
serviceName0, endpoint0, _ := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, endpoint0, _ := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "gochain", "-k", "keystores/keystore.json", "-n", "0x9", "-e", endpoint0, "-s", serviceName0, "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand All @@ -629,7 +632,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
serviceName0, _, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
serviceName0, _, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "gochain", "-k", "keystores/keystore.json", "-n", nid0, "-e", "http://172.16.0.3:9081/api/v3/icon_dex", "-s", serviceName0, "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand All @@ -639,7 +643,8 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should handle invalid input for chain command", func() {
enclaveName := dive.GenerateRandomName()
dive.RunIconNode(enclaveName)
_, endpoint0, nid0 := dive.GetServiceDetails(fmt.Sprintf("services_%s.json", enclaveName), dive.ICON_CONFIG0_SERVICENAME)
service_path, _ := filepath.Glob(fmt.Sprintf("output/%s/services_%s_*.json", enclaveName, enclaveName))
_, endpoint0, nid0 := dive.GetServiceDetails(service_path[0], dive.ICON_CONFIG0_SERVICENAME)
cmd.Args = append(cmd.Args, "chain", "icon", "decentralize", "-p", "gochain", "-k", "keystores/keystore.json", "-n", nid0, "-e", endpoint0, "-s", "icon-node", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
Expand Down Expand Up @@ -717,10 +722,9 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should run single custom archway node with invalid json path", func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "chain", "archway", "-c", "../../cli/sample-jsons/invalid_archway.json", "--enclaveName", enclaveName)
defer dive.Clean(enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
dive.Clean(enclaveName)
defer dive.Clean(enclaveName)
})

ginkgo.It("should output user that chain is already running when trying to run archway chain that is already running", func() {
Expand Down Expand Up @@ -952,7 +956,7 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
if paraChainName != "parallel" && paraChainName != "subzero" {
enclaveName := dive.GenerateRandomName()
config := dive.UpdateParaChain(dive.LOCAL_CONFIG0, "testnet", paraChainName)
cmd.Args = append(cmd.Args, "chain", relayChainName, "--no-relay", "-c", config, "--enclaveName", enclaveName)
cmd.Args = append(cmd.Args, "chain", relayChainName, "-c", config, "--enclaveName", enclaveName)
defer os.Remove(config)
err := cmd.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
Expand All @@ -962,20 +966,20 @@ var _ = ginkgo.Describe("DIVE CLI App", func() {
ginkgo.It("should run custom parachain in mainnet for "+relayChainName+" and "+paraChainName, func() {
enclaveName := dive.GenerateRandomName()
config := dive.UpdateParaChain(dive.LOCAL_CONFIG0, "mainnet", paraChainName)
cmd.Args = append(cmd.Args, "chain", relayChainName, "--no-relay", "-c", config, "--enclaveName", enclaveName)
cmd.Args = append(cmd.Args, "chain", relayChainName, "-c", config, "--enclaveName", enclaveName)
defer os.Remove(config)
err := cmd.Run()
gomega.Expect(err).NotTo(gomega.HaveOccurred())
dive.Clean(enclaveName)
})
ginkgo.It("should run single parachain in localnet for "+relayChainName+" and "+paraChainName, func() {
ginkgo.It("should not run single parachain in localnet for "+relayChainName+" and "+paraChainName, func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "chain", relayChainName, "-p", paraChainName, "--no-relay", "-n", "local", "--enclaveName", enclaveName)
err := cmd.Run()
gomega.Expect(err).To(gomega.HaveOccurred())
dive.Clean(enclaveName)
})
ginkgo.It("should run single parachain without giving network type for "+relayChainName+" and "+paraChainName, func() {
ginkgo.It("should not run single parachain without giving network type for "+relayChainName+" and "+paraChainName, func() {
enclaveName := dive.GenerateRandomName()
cmd.Args = append(cmd.Args, "chain", relayChainName, "-p", paraChainName, "--no-relay", "--enclaveName", enclaveName)
err := cmd.Run()
Expand Down

0 comments on commit fe1d0ca

Please sign in to comment.