forked from ava-labs/icm-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e_test.go
117 lines (105 loc) · 3.02 KB
/
e2e_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package tests
import (
"encoding/hex"
"os"
"testing"
testUtils "github.com/ava-labs/awm-relayer/tests/utils"
"github.com/ava-labs/awm-relayer/utils"
"github.com/ava-labs/teleporter/tests/local"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
const (
warpGenesisTemplateFile = "./tests/utils/warp-genesis-template.json"
)
var localNetworkInstance *local.LocalNetwork
func TestE2E(t *testing.T) {
if os.Getenv("RUN_E2E") == "" {
t.Skip("Environment variable RUN_E2E not set; skipping E2E tests")
}
RegisterFailHandler(ginkgo.Fail)
ginkgo.RunSpecs(t, "Relayer e2e test")
}
// Define the Relayer before and after suite functions.
var _ = ginkgo.BeforeSuite(func() {
localNetworkInstance = local.NewLocalNetwork(
"awm-relayer-e2e-test",
warpGenesisTemplateFile,
[]local.SubnetSpec{
{
Name: "A",
EVMChainID: 12345,
NodeCount: 5,
},
{
Name: "B",
EVMChainID: 54321,
NodeCount: 5,
},
},
0,
)
// Generate the Teleporter deployment values
teleporterContractAddress := common.HexToAddress(
testUtils.ReadHexTextFile("./tests/utils/UniversalTeleporterMessengerContractAddress.txt"),
)
teleporterDeployerAddress := common.HexToAddress(
testUtils.ReadHexTextFile("./tests/utils/UniversalTeleporterDeployerAddress.txt"),
)
teleporterDeployerTransactionStr := testUtils.ReadHexTextFile(
"./tests/utils/UniversalTeleporterDeployerTransaction.txt",
)
teleporterDeployerTransaction, err := hex.DecodeString(
utils.SanitizeHexString(teleporterDeployerTransactionStr),
)
Expect(err).Should(BeNil())
_, fundedKey := localNetworkInstance.GetFundedAccountInfo()
localNetworkInstance.DeployTeleporterContracts(
teleporterDeployerTransaction,
teleporterDeployerAddress,
teleporterContractAddress,
fundedKey,
true,
)
log.Info("Deployed Teleporter contracts")
localNetworkInstance.DeployTeleporterRegistryContracts(
teleporterContractAddress,
fundedKey,
)
log.Info("Set up ginkgo before suite")
ginkgo.AddReportEntry(
"network directory with node logs & configs; useful in the case of failures",
localNetworkInstance.Dir(),
ginkgo.ReportEntryVisibilityFailureOrVerbose,
)
})
var _ = ginkgo.AfterSuite(func() {
localNetworkInstance.TearDownNetwork()
})
var _ = ginkgo.Describe("[AWM Relayer Integration Tests", func() {
ginkgo.It("Manually Provided Message", func() {
ManualMessage(localNetworkInstance)
})
ginkgo.It("Basic Relay", func() {
BasicRelay(localNetworkInstance)
})
ginkgo.It("Shared Database", func() {
SharedDatabaseAccess(localNetworkInstance)
})
ginkgo.It("Allowed Addresses", func() {
AllowedAddresses(localNetworkInstance)
})
ginkgo.It("Batch Message", func() {
BatchRelay(localNetworkInstance)
})
ginkgo.It("Relay Message API", func() {
RelayMessageAPI(localNetworkInstance)
})
ginkgo.It("Warp API", func() {
WarpAPIRelay(localNetworkInstance)
})
})