github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/test/devstack/multiple_cid_test.go (about) 1 //go:build integration 2 3 package devstack 4 5 import ( 6 "path/filepath" 7 "testing" 8 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 MultipleCIDSuite 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 TestMultipleCIDSuite(t *testing.T) { 23 suite.Run(t, new(MultipleCIDSuite)) 24 } 25 26 func (s *MultipleCIDSuite) TestMultipleCIDs() { 27 dirCID1 := "/input-1" 28 dirCID2 := "/input-2" 29 30 fileName1 := "hello-cid-1.txt" 31 fileName2 := "hello-cid-2.txt" 32 33 testCase := scenario.Scenario{ 34 Inputs: scenario.ManyStores( 35 scenario.StoredText("file1\n", filepath.Join(dirCID1, fileName1)), 36 scenario.StoredText("file2\n", filepath.Join(dirCID2, fileName2)), 37 ), 38 Spec: model.Spec{ 39 Engine: model.EngineWasm, 40 Verifier: model.VerifierNoop, 41 Publisher: model.PublisherIpfs, 42 Wasm: model.JobSpecWasm{ 43 EntryPoint: scenario.CatFileToStdout.Spec.Wasm.EntryPoint, 44 EntryModule: scenario.CatFileToStdout.Spec.Wasm.EntryModule, 45 Parameters: []string{ 46 filepath.Join(dirCID1, fileName1), 47 filepath.Join(dirCID2, fileName2), 48 }, 49 }, 50 }, 51 ResultsChecker: scenario.ManyChecks( 52 scenario.FileEquals(model.DownloadFilenameStdout, "file1\nfile2\n"), 53 ), 54 JobCheckers: []job.CheckStatesFunction{ 55 job.WaitForSuccessfulCompletion(), 56 }, 57 } 58 59 s.RunScenario(testCase) 60 }