Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ concurrency:
cancel-in-progress: true

jobs:
test-unit:
name: test-unit
test-unit-short:
name: test-unit-short
strategy:
fail-fast: false
matrix:
Expand All @@ -38,6 +38,30 @@ jobs:
- name: Test
run: make test-unit

test-unit-all:
name: test-unit-all
strategy:
fail-fast: false
matrix:
go-version: [1.25.7]
goarch: ["amd64"]
runs-on: amd-runner-2204
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install Go
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
env:
GOARCH: ${{ matrix.goarch }}

- name: Test
run: make test-unit-all

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6.0.0
env:
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ build-docker-debug: ## Builds a debug docker image (dlv headless on :40000, no o
docker build -t aggkit:local-debug -f ./Dockerfile.debug .

.PHONY: test-unit
test-unit: ## Runs the unit tests
test-unit: ## Runs the short unit tests
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -short -race -p 1 -covermode=atomic -coverprofile=coverage.out -timeout 15m ./...
Comment thread
arnaubennassar marked this conversation as resolved.

.PHONY: test-unit-all
test-unit-all: ## Runs all unit tests
trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -p 1 -covermode=atomic -coverprofile=coverage.out -timeout 15m ./...

.PHONY: test-e2e
test-e2e: ## Runs the e2e tests
go test -v -timeout 30m ./test/e2e/...
Expand Down
6 changes: 6 additions & 0 deletions aggoracle/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
)

func TestEVM_GERInjection(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
tests := []struct {
name string
enableAggOracleCommittee bool
Expand Down Expand Up @@ -72,6 +75,9 @@ func TestEVM_GERInjection(t *testing.T) {
}

func TestEVM_AggOracleCommitteeModeWithQuorum3(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
cfg := helpers.DefaultEnvironmentConfig(helpers.SovereignChainL2GERContract)
cfg.AggOracleCommitteeCfg.EnableAggOracleCommittee = true
cfg.AggOracleCommitteeCfg.Quorum = 3
Expand Down
3 changes: 3 additions & 0 deletions bridgesync/backfill_tx_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,9 @@ func TestBackfillTxnSender_getRecordsNeedingBackfill_Cases(t *testing.T) {
}

func TestBackfillTxnSenderIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
// Skip integration test if no RPC URL is provided
rpcURL := os.Getenv("TEST_RPC_URL")
if rpcURL == "" {
Expand Down
12 changes: 12 additions & 0 deletions bridgesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func mockClientCallGetTransactionByHash(t *testing.T,
}

func TestBridgeEventE2E(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
const (
blockTime = time.Millisecond * 10
totalBridges = 80
Expand Down Expand Up @@ -178,6 +181,9 @@ func getFinalizedBlockNumber(t *testing.T, ctx context.Context, client simulated

// TestBridgeL1SyncerWithReorgDetector tests the bridge L1 syncer with reorg detector
func TestBridgeL1SyncerWithReorgDetector(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
dbPathSyncer := path.Join(t.TempDir(), "bridgesyncTestWithReorgs_sync.sqlite")
dbPathReorg := path.Join(t.TempDir(), "bridgesyncTestWithReorgs_reorg.sqlite")
Expand Down Expand Up @@ -363,6 +369,9 @@ func TestBridgeL1SyncerWithReorgDetector(t *testing.T) {

// TestReorgWithSameHashEdgeCase tests reorg detection when blocks have same hash
func TestReorgWithSameHashEdgeCase(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
dbPathSyncer := path.Join(t.TempDir(), "bridgesyncTestSameHashReorg_sync.sqlite")
dbPathReorg := path.Join(t.TempDir(), "bridgesyncTestSameHashReorg_reorg.sqlite")
Expand Down Expand Up @@ -482,6 +491,9 @@ func TestReorgWithSameHashEdgeCase(t *testing.T) {

// TestBridgeL1SyncerWithMultipleReorgs tests the bridge L1 syncer with multiple reorgs
func TestBridgeL1SyncerWithMultipleReorgs(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
dbPathSyncer := path.Join(t.TempDir(), "bridgesyncTestWithReorgs_sync.sqlite")
dbPathReorg := path.Join(t.TempDir(), "bridgesyncTestWithReorgs_reorg.sqlite")
Expand Down
9 changes: 9 additions & 0 deletions claimsync/agglayer_bridge_l2_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_IteratorCloseError(t

// Test with simulated backend to get real contract behavior
func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_SimulatedBackend(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
bridgeAddr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")

Expand All @@ -282,6 +285,9 @@ func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_SimulatedBackend(t *

// Test with real contract events to test iterator behavior
func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_WithRealEvents(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
bridgeAddr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")

Expand Down Expand Up @@ -310,6 +316,9 @@ func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_WithRealEvents(t *te

// Test the actual iterator behavior by creating a test that exercises the iterator loop
func TestAgglayerBridgeL2Reader_GetUnsetClaimsForBlockRange_IteratorBehavior(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
bridgeAddr := common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678")

Expand Down
3 changes: 3 additions & 0 deletions claimsync/claimcalldata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ type testCase struct {
}

func TestClaimCalldata(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
testCases := make([]testCase, 0, 46)

ctx, cancelFn := context.WithCancel(context.Background())
Expand Down
3 changes: 3 additions & 0 deletions claimsync/claimsync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ func TestGetLastBlockNumByGlobalIndexFromRPC_Exploratory(t *testing.T) {
// 5. Call SetNextRequiredBlock(ctx, 1) to unlock the syncer.
// 6. Assert GetLastProcessedBlock returns found=true β€” the syncer processed the blocks and captured the event.
func TestClaimSyncerWaitUntilSetNextRequiredBlock(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx, cancelFn := context.WithCancel(context.Background())
// Setup Docker L1
client, auth := startGeth(t, ctx, cancelFn)
Expand Down
3 changes: 3 additions & 0 deletions etherman/querier/rollup_data_querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ func TestFetchRollupID(t *testing.T) {
}

func TestRollupDataQuerier_GetUpgradeBlock(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
const (
latestAgglayerManagerVersion = uint8(5)
startBlock = uint64(0)
Expand Down
9 changes: 9 additions & 0 deletions l1infotreesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func newSimulatedClient(t *testing.T) (
}

func TestE2E(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := t.Context()
dbPath := path.Join(t.TempDir(), "l1infotreesyncTestE2E.sqlite")

Expand Down Expand Up @@ -164,6 +167,9 @@ func TestE2E(t *testing.T) {

func TestWithReorgs(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
tests := []struct {
name string
useMultidownloaderForTest bool
Expand Down Expand Up @@ -399,6 +405,9 @@ func showLeafs(t *testing.T, ctx context.Context, syncer *l1infotreesync.L1InfoT
}

func TestStressAndReorgs(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
t.Skip("Skipping E2E test, this test is works locally but fails in CI")
const (
totalIterations = 3
Expand Down
9 changes: 9 additions & 0 deletions l2gersync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const (
)

func TestL2GERSyncE2E(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
t.Parallel()

t.Skip("Skipping E2E test, this test is broken and needs a PR to be fixed. The lastProcessedBlock doesn't take in account empty blocks")
Expand Down Expand Up @@ -65,6 +68,9 @@ func TestL2GERSyncE2E(t *testing.T) {
}

func TestL2GERSync_GERRemoval(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
t.Parallel()

t.Skip("Skipping E2E test, this test is broken and needs a PR to be fixed. The lastProcessedBlock doesn't take in account empty blocks")
Expand Down Expand Up @@ -130,6 +136,9 @@ func TestL2GERSync_GERRemoval(t *testing.T) {
}

func TestL2GERSync_IndexLegacyGERManagerSC(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
t.Parallel()

ctx := context.Background()
Expand Down
6 changes: 6 additions & 0 deletions l2gersync/l2_evm_ger_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func TestValidateL2GERContract(t *testing.T) {

func TestL2EVMGERReader_GetInjectedGERsForRange(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}

ctx := context.Background()

Expand Down Expand Up @@ -170,6 +173,9 @@ func TestL2EVMGERReader_GetInjectedGERsForRange(t *testing.T) {

func TestL2EVMGERReader_GetRemovedGERsForRange(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}

ctx := context.Background()

Expand Down
3 changes: 3 additions & 0 deletions pprof/pprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
)

func TestStartProfilingHttpServer(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
// Mock configuration
config := Config{
ProfilingHost: "127.0.0.1",
Expand Down
18 changes: 18 additions & 0 deletions reorgdetector/reorgdetector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ func Test_ReorgDetector(t *testing.T) {
}

func TestGetTrackedBlocks(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000))
testDir := path.Join(t.TempDir(), "reorgdetector_TestGetTrackedBlocks.sqlite")
reorgDetector, err := New(etherman.NewDefaultEthClient(clientL1.Client(), nil, nil), Config{
Expand Down Expand Up @@ -208,6 +211,9 @@ func TestGetTrackedBlocks(t *testing.T) {
}

func TestNotSubscribed(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000))
testDir := path.Join(t.TempDir(), "reorgdetectorTestNotSubscribed.sqlite")
reorgDetector, err := New(etherman.NewDefaultEthClient(clientL1.Client(), nil, nil),
Expand All @@ -219,6 +225,9 @@ func TestNotSubscribed(t *testing.T) {

func TestDetectReorgs(t *testing.T) {
t.Parallel()
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}

ctx := context.Background()
syncerID := "test-syncer"
Expand Down Expand Up @@ -314,6 +323,9 @@ func TestDetectReorgs(t *testing.T) {
}

func TestLoadTrackedHeaders_ConcurrentWithSaveTrackedBlock(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000))
testDir := path.Join(t.TempDir(), "reorgdetectorTestConcurrentSave.sqlite")
reorgDetector, err := New(etherman.NewDefaultEthClient(clientL1.Client(), nil, nil), Config{
Expand Down Expand Up @@ -363,6 +375,9 @@ func TestLoadTrackedHeaders_ConcurrentWithSaveTrackedBlock(t *testing.T) {
}

func TestGetTrackedBlockByBlockNumber(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
ctx := context.Background()
clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000))
testDir := path.Join(t.TempDir(), "reorgdetectorTestGetTrackedBlockByBlockNumber.sqlite")
Expand Down Expand Up @@ -402,6 +417,9 @@ func TestGetTrackedBlockByBlockNumber(t *testing.T) {
}

func TestGetDB(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in -short mode")
}
clientL1 := simulated.NewBackend(nil, simulated.WithBlockGasLimit(10000000))
testDir := path.Join(t.TempDir(), "reorgdetectorTestGetDB.sqlite")

Expand Down
Loading