Skip to content

Commit

Permalink
test: Update backend unit tests to not retrieve PipelineSpec from moc…
Browse files Browse the repository at this point in the history
…k ObjStore

- Add PipelineSpec to mock PVs as they are no longer retrieved from
  ObjStore

Signed-off-by: Giulio Frasca <[email protected]>
  • Loading branch information
gmfrasca committed Aug 15, 2024
1 parent 1b12d83 commit 4bbea81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions backend/src/apiserver/resource/resource_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,18 @@ func TestDeletePipelineVersion_FileError(t *testing.T) {
assert.True(t, ok)
pipelineStore.SetUUIDGenerator(util.NewFakeUUIDGeneratorOrFatal(FakeUUIDOne, nil))
manager.CreatePipelineVersion(pv)

// Switch to a bad object store
manager.objectStore = &FakeBadObjectStore{}

// Delete the above pipeline_version.
err = manager.DeletePipelineVersion(FakeUUIDOne)
assert.Nil(t, err)

// Verify the version in deleting status.
version, err := manager.pipelineStore.GetPipelineVersionWithStatus(FakeUUIDOne, model.PipelineVersionDeleting)
assert.NotNil(t, err)
assert.Nil(t, version)
}

// Tests DeletePipeline
Expand Down
10 changes: 6 additions & 4 deletions backend/src/apiserver/server/fakes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ func initWithExperimentsAndTwoPipelineVersions(t *testing.T) *resource.FakeClien
resourceManager = resource.NewResourceManager(clientManager, &resource.ResourceManagerOptions{CollectMetrics: false})
_, err = resourceManager.CreatePipelineVersion(
&model.PipelineVersion{
Name: "pipeline_version",
PipelineId: DefaultFakeUUID,
Name: "pipeline_version",
PipelineId: DefaultFakeUUID,
PipelineSpec: "apiVersion: argoproj.io/v1alpha1\nkind: Workflow",
},
)
assert.Nil(t, err)
Expand Down Expand Up @@ -302,8 +303,9 @@ func initWithExperimentsAndTwoPipelineVersions(t *testing.T) *resource.FakeClien
resourceManager = resource.NewResourceManager(clientManager, &resource.ResourceManagerOptions{CollectMetrics: false})
_, err = resourceManager.CreatePipelineVersion(
&model.PipelineVersion{
Name: "another_pipeline_version",
PipelineId: NonDefaultFakeUUID,
Name: "another_pipeline_version",
PipelineId: NonDefaultFakeUUID,
PipelineSpec: "apiVersion: argoproj.io/v1alpha1\nkind: Workflow",
},
)
assert.Nil(t, err)
Expand Down

0 comments on commit 4bbea81

Please sign in to comment.