github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/test/simulator/server_test.go (about)

     1  package simulator
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/filecoin-project/bacalhau/pkg/devstack"
     7  	"github.com/filecoin-project/bacalhau/pkg/model"
     8  	"github.com/filecoin-project/bacalhau/pkg/system"
     9  	"github.com/filecoin-project/bacalhau/pkg/test/scenario"
    10  	"github.com/stretchr/testify/suite"
    11  )
    12  
    13  type SimulatorSuite struct {
    14  	scenario.ScenarioRunner
    15  }
    16  
    17  // In order for 'go test' to run this suite, we need to create
    18  // a normal test function and pass our suite to suite.Run
    19  func TestSimulatorSuite(t *testing.T) {
    20  	suite.Run(t, new(SimulatorSuite))
    21  }
    22  
    23  // Test that the combo driver gives preference to the filecoin unsealed driver
    24  // also that this does not affect normal jobs where the CID resides on the IPFS driver
    25  func (suite *SimulatorSuite) TestSimulatorSanity() {
    26  	system.InitConfigForTesting(suite.T())
    27  
    28  	nodeCount := 3
    29  	s := scenario.Scenario{
    30  		JobCheckers: scenario.WaitUntilSuccessful(3),
    31  		Spec: model.Spec{
    32  			Engine: model.EngineWasm,
    33  			Wasm: model.JobSpecWasm{
    34  				EntryPoint:  scenario.WasmHelloWorld.Spec.Wasm.EntryPoint,
    35  				EntryModule: scenario.WasmHelloWorld.Spec.Wasm.EntryModule,
    36  				Parameters:  []string{},
    37  			},
    38  		},
    39  		Deal: model.Deal{
    40  			Concurrency: 3,
    41  		},
    42  	}
    43  
    44  	s.Stack = &scenario.StackConfig{
    45  		DevStackOptions: &devstack.DevStackOptions{
    46  			NumberOfHybridNodes: nodeCount,
    47  			SimulatorMode:       true,
    48  		},
    49  	}
    50  
    51  	suite.RunScenario(s)
    52  }