github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/test/devstack/concurrency_test.go (about) 1 //go:build integration 2 3 package devstack 4 5 import ( 6 "testing" 7 8 "github.com/filecoin-project/bacalhau/pkg/devstack" 9 "github.com/filecoin-project/bacalhau/pkg/job" 10 _ "github.com/filecoin-project/bacalhau/pkg/logger" 11 "github.com/filecoin-project/bacalhau/pkg/model" 12 "github.com/filecoin-project/bacalhau/pkg/test/scenario" 13 "github.com/stretchr/testify/suite" 14 ) 15 16 type DevstackConcurrencySuite struct { 17 scenario.ScenarioRunner 18 } 19 20 // In order for 'go test' to run this suite, we need to create 21 // a normal test function and pass our suite to suite.Run 22 func TestDevstackConcurrencySuite(t *testing.T) { 23 suite.Run(t, new(DevstackConcurrencySuite)) 24 } 25 26 func (suite *DevstackConcurrencySuite) TestConcurrencyLimit() { 27 28 testCase := scenario.WasmHelloWorld 29 testCase.Stack = &scenario.StackConfig{ 30 DevStackOptions: &devstack.DevStackOptions{NumberOfHybridNodes: 3}, 31 } 32 testCase.Deal = model.Deal{Concurrency: 2} 33 testCase.ResultsChecker = scenario.FileEquals( 34 model.DownloadFilenameStdout, 35 "Hello, world!\nHello, world!\n", 36 ) 37 testCase.JobCheckers = []job.CheckStatesFunction{ 38 job.WaitForSuccessfulCompletion(), 39 } 40 41 suite.RunScenario(testCase) 42 }