forked from ava-labs/icm-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e_test.go
74 lines (63 loc) · 2.27 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
// 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 (
warpGenesisFile = "./tests/utils/warp-genesis.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(warpGenesisFile)
// 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")
})
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("Teleporter Registry", func() {
TeleporterRegistry(localNetworkInstance)
})
})