Modify test with less nodes and incrrease job timeout

This commit is contained in:
aya 2025-03-12 16:46:02 +02:00
parent 1989546fc9
commit a84466dc88
2 changed files with 7 additions and 7 deletions

View File

@ -40,7 +40,7 @@ jobs:
- name: Run Endurance Test - name: Run Endurance Test
run: | run: |
# Increase timeout so long-running tests won't kill the job prematurely # Increase timeout so long-running tests won't kill the job prematurely
go test -v ./waku -count=1 -timeout=45m -run Test5Nodes1kTearDown ./... | tee testlogs.log go test -v ./waku -count=1 -timeout=300m -run Test5Nodes1kTearDown ./... | tee testlogs.log
- name: Upload Test Logs - name: Upload Test Logs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -79,7 +79,7 @@ func TestMemoryUsageForThreeNodes(t *testing.T) {
Debug("[%s] Test completed successfully", testName) Debug("[%s] Test completed successfully", testName)
} }
func Test5Nodes1kTearDown(t *testing.T) { func Test2Nodes1kTearDown(t *testing.T) {
logFile, err := os.OpenFile("test_repeated_start_stop.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666) logFile, err := os.OpenFile("test_repeated_start_stop.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
require.NoError(t, err) require.NoError(t, err)
defer logFile.Close() defer logFile.Close()
@ -98,10 +98,10 @@ func Test5Nodes1kTearDown(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
Debug("[%s] OS-level RSS at test START: %d KB", t.Name(), initialRSS) Debug("[%s] OS-level RSS at test START: %d KB", t.Name(), initialRSS)
totalIterations := 1000 totalIterations := 501
for i := 1; i <= totalIterations; i++ { for i := 1; i <= totalIterations; i++ {
var nodes []*WakuNode var nodes []*WakuNode
for n := 1; n <= 5; n++ { for n := 1; n <= 2; n++ {
cfg := DefaultWakuConfig cfg := DefaultWakuConfig
cfg.Relay = true cfg.Relay = true
cfg.Discv5Discovery = false cfg.Discv5Discovery = false
@ -119,15 +119,15 @@ func Test5Nodes1kTearDown(t *testing.T) {
msgHash, err := nodes[0].RelayPublishNoCTX(DefaultPubsubTopic, message) msgHash, err := nodes[0].RelayPublishNoCTX(DefaultPubsubTopic, message)
require.NoError(t, err) require.NoError(t, err)
time.Sleep(500 * time.Millisecond) time.Sleep(500 * time.Millisecond)
err = nodes[4].VerifyMessageReceived(message, msgHash, 500*time.Millisecond) err = nodes[1].VerifyMessageReceived(message, msgHash, 500*time.Millisecond)
require.NoError(t, err, "Node5 did not receive message from node1") require.NoError(t, err, "Node1 did not receive message from node1")
for _, node := range nodes { for _, node := range nodes {
node.StopAndDestroy() node.StopAndDestroy()
} }
runtime.GC() runtime.GC()
time.Sleep(250 * time.Millisecond) time.Sleep(250 * time.Millisecond)
runtime.GC() runtime.GC()
if i == 500 || i == 1000 { if i == 250 || i == 500 {
runtime.ReadMemStats(&memStats) runtime.ReadMemStats(&memStats)
Debug("Iteration %d, usage after teardown: %d KB", i, memStats.HeapAlloc/1024) Debug("Iteration %d, usage after teardown: %d KB", i, memStats.HeapAlloc/1024)
require.LessOrEqual(t, memStats.HeapAlloc, initialMem*3, "Memory usage soared above threshold after iteration %d", i) require.LessOrEqual(t, memStats.HeapAlloc, initialMem*3, "Memory usage soared above threshold after iteration %d", i)