github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/test/scenario/example_basic_test.go (about) 1 package scenario 2 3 import ( 4 "testing" 5 6 "github.com/filecoin-project/bacalhau/pkg/model" 7 "github.com/stretchr/testify/suite" 8 ) 9 10 var basicScenario Scenario = Scenario{ 11 Inputs: StoredText("hello, world!", "/inputs"), 12 Contexts: StoredFile("../../../testdata/wasm/cat/main.wasm", "/job"), 13 Outputs: []model.StorageSpec{}, 14 Spec: model.Spec{ 15 Engine: model.EngineWasm, 16 Wasm: model.JobSpecWasm{ 17 EntryPoint: "_start", 18 }, 19 }, 20 ResultsChecker: FileEquals(model.DownloadFilenameStdout, "hello, world!\n"), 21 JobCheckers: WaitUntilSuccessful(1), 22 } 23 24 type ExampleTest struct { 25 ScenarioRunner 26 } 27 28 func Example_basic() { 29 // In a real example, use the testing.T passed to the TestXxx method. 30 suite.Run(&testing.T{}, new(ExampleTest)) 31 } 32 33 func (suite *ExampleTest) TestRun() { 34 suite.RunScenario(basicScenario) 35 }