Skip to content

Commit ee4bb23

Browse files
committed
chore: clean up
1 parent 3d7d3d2 commit ee4bb23

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

framework/components/blockchain/blockchain.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ type Input struct {
5555
ContainerResources *framework.ContainerResources `toml:"resources"`
5656
CustomPorts []string `toml:"custom_ports"`
5757

58-
// Ton
59-
CoreServices []string `toml:"core_services"`
58+
// Ton - MyLocalTon essesntial services to run tests
59+
TonCoreServices []string `toml:"ton_core_services"`
6060
}
6161

6262
// Output is a blockchain network output, ChainID and one or more nodes that forms the network

framework/components/blockchain/ton.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ const (
3131

3232
func defaultTon(in *Input) {
3333
if in.Image == "" {
34-
// Note: mylocalton is a compose file, not a single image. Reusing common image field
34+
// Note: mylocalton uses a compose file, not a single image. Reusing common image field
3535
in.Image = "https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml"
36+
}
37+
// Note: in local env having all services could be useful(explorer, faucet), in CI we need only core services
38+
if os.Getenv("CI") == "true" && len(in.TonCoreServices) == 0 {
3639
// Note: mylocalton-docker's essential services, excluded explorer, restarter, faucet app,
37-
in.CoreServices = []string{
40+
in.TonCoreServices = []string{
3841
"genesis", "tonhttpapi", "event-cache",
3942
"index-postgres", "index-worker", "index-api",
4043
}
@@ -87,14 +90,9 @@ func newTon(in *Input) (*Output, error) {
8790

8891
var upOpts []compose.StackUpOption
8992
upOpts = append(upOpts, compose.Wait(true))
90-
services := []string{}
91-
// Note: in local env having all services could be useful(explorer, faucet), in CI we need only core services
92-
if os.Getenv("CI") == "true" && len(services) == 0 {
93-
services = in.CoreServices
94-
}
9593

96-
if len(services) > 0 {
97-
upOpts = append(upOpts, compose.RunServices(services...))
94+
if len(in.TonCoreServices) > 0 {
95+
upOpts = append(upOpts, compose.RunServices(in.TonCoreServices...))
9896
}
9997

10098
// always wait for healthy
@@ -133,7 +131,7 @@ func newTon(in *Input) (*Output, error) {
133131
ContainerName: containerName,
134132
// Note: in case we need 1+ validators, we need to modify the compose file
135133
Nodes: []*Node{{
136-
// todo: define if we need more access other than lite client(tonutils-go only needs lite client)
134+
// Note: define if we need more access other than lite client(tonutils-go only needs lite client)
137135
ExternalHTTPUrl: fmt.Sprintf("%s:%s", liteHost, litePort.Port()),
138136
}},
139137
NetworkSpecificData: &NetworkSpecificData{

framework/examples/myproject/smoke_ton.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[blockchain_a]
22
type = "ton"
33
image = "https://raw.githubusercontent.com/neodix42/mylocalton-docker/main/docker-compose.yaml"
4-
core_services = [
4+
ton_core_services = [
55
"genesis",
66
"tonhttpapi",
77
"event-cache",

framework/examples/myproject/smoke_ton_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestTonSmoke(t *testing.T) {
2424
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
2525
require.NoError(t, err)
2626

27-
var client *ton.APIClient
27+
var client ton.APIClientWrapped
2828

2929
t.Run("setup:connect", func(t *testing.T) {
3030
connectionPool := liteclient.NewConnectionPool()
@@ -33,7 +33,7 @@ func TestTonSmoke(t *testing.T) {
3333
require.NoError(t, cferr, "Failed to get config from URL")
3434
caerr := connectionPool.AddConnectionsFromConfig(t.Context(), cfg)
3535
require.NoError(t, caerr, "Failed to add connections from config")
36-
client = ton.NewAPIClient(connectionPool)
36+
client = ton.NewAPIClient(connectionPool).WithRetry()
3737

3838
t.Run("setup:faucet", func(t *testing.T) {
3939
// network is already funded
@@ -43,12 +43,14 @@ func TestTonSmoke(t *testing.T) {
4343
require.NoError(t, err, "failed to create highload wallet")
4444
funder, err := mcFunderWallet.GetSubwallet(uint32(42))
4545
require.NoError(t, err, "failed to get highload subwallet")
46+
47+
// double check funder address
4648
require.Equal(t, funder.Address().StringRaw(), blockchain.DefaultTonHlWalletAddress, "funder address mismatch")
4749

50+
// check funder balance
4851
master, err := client.GetMasterchainInfo(t.Context())
4952
require.NoError(t, err, "failed to get masterchain info for funder balance check")
5053
funderBalance, err := funder.GetBalance(t.Context(), master)
51-
t.Log("Funder balance: ", funderBalance)
5254
require.NoError(t, err, "failed to get funder balance")
5355
require.Equal(t, funderBalance.Nano().String(), "1000000000000000", "funder balance mismatch")
5456
})

0 commit comments

Comments
 (0)