mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-13 16:08:04 -05:00
Co-authored-by: Péter Garamvölgyi <peter@scroll.io> Co-authored-by: ChuhanJin <60994121+ChuhanJin@users.noreply.github.com> Co-authored-by: vincent <419436363@qq.com> Co-authored-by: colinlyguo <651734127@qq.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
55 lines
928 B
Go
55 lines
928 B
Go
package docker_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
_ "github.com/lib/pq" //nolint:golint
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"scroll-tech/common/docker"
|
|
)
|
|
|
|
var (
|
|
base *docker.App
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
base = docker.NewDockerApp()
|
|
|
|
m.Run()
|
|
|
|
base.Free()
|
|
}
|
|
|
|
func TestDB(t *testing.T) {
|
|
base.RunDBImage(t)
|
|
|
|
db, err := sqlx.Open("postgres", base.DBImg.Endpoint())
|
|
assert.NoError(t, err)
|
|
assert.NoError(t, db.Ping())
|
|
}
|
|
|
|
func TestL1Geth(t *testing.T) {
|
|
base.RunL1Geth(t)
|
|
|
|
client, err := base.L1Client()
|
|
assert.NoError(t, err)
|
|
|
|
chainID, err := client.ChainID(context.Background())
|
|
assert.NoError(t, err)
|
|
t.Logf("chainId: %s", chainID.String())
|
|
}
|
|
|
|
func TestL2Geth(t *testing.T) {
|
|
base.RunL2Geth(t)
|
|
|
|
client, err := base.L2Client()
|
|
assert.NoError(t, err)
|
|
|
|
chainID, err := client.ChainID(context.Background())
|
|
assert.NoError(t, err)
|
|
t.Logf("chainId: %s", chainID.String())
|
|
}
|