diff --git a/api/v1alpha1/freight_helpers.go b/api/v1alpha1/freight_helpers.go index bbe636949..6d8de7f5b 100644 --- a/api/v1alpha1/freight_helpers.go +++ b/api/v1alpha1/freight_helpers.go @@ -129,17 +129,6 @@ func (f *Freight) IsVerifiedIn(stage string) bool { return verified } -// IsVerifiedInAll returns whether the Freight has been verified in all -// Stages. -func (f *Freight) IsVerifiedInAll(stages []string) bool { - for _, s := range stages { - if !f.IsVerifiedIn(s) { - return false - } - } - return true -} - // IsApprovedFor returns whether the Freight has been approved for the specified // Stage. func (f *Freight) IsApprovedFor(stage string) bool { diff --git a/api/v1alpha1/freight_helpers_test.go b/api/v1alpha1/freight_helpers_test.go index 15ce6b924..ac4e51804 100644 --- a/api/v1alpha1/freight_helpers_test.go +++ b/api/v1alpha1/freight_helpers_test.go @@ -234,69 +234,6 @@ func TestFreight_IsVerifiedIn(t *testing.T) { require.True(t, freight.IsVerifiedIn(testStage)) } -func TestFreight_IsVerifiedInAll(t *testing.T) { - testCases := []struct { - name string - freight Freight - stages []string - expected bool - }{ - { - name: "Freight is not verified in any stage", - freight: Freight{ - Status: FreightStatus{ - VerifiedIn: map[string]VerifiedStage{}, - }, - }, - stages: []string{"stage1", "stage2"}, - expected: false, - }, - { - name: "Freight is verified in all stages", - freight: Freight{ - Status: FreightStatus{ - VerifiedIn: map[string]VerifiedStage{ - "stage1": {}, - "stage2": {}, - }, - }, - }, - stages: []string{"stage1", "stage2"}, - expected: true, - }, - { - name: "Freight is verified in some stages", - freight: Freight{ - Status: FreightStatus{ - VerifiedIn: map[string]VerifiedStage{ - "stage1": {}, - }, - }, - }, - stages: []string{"stage1", "stage2"}, - expected: false, - }, - { - name: "Freight is verified in all stages but not in the same order", - freight: Freight{ - Status: FreightStatus{ - VerifiedIn: map[string]VerifiedStage{ - "stage2": {}, - "stage1": {}, - }, - }, - }, - stages: []string{"stage1", "stage2"}, - expected: true, - }, - } - for _, testCase := range testCases { - t.Run(testCase.name, func(t *testing.T) { - require.Equal(t, testCase.expected, testCase.freight.IsVerifiedInAll(testCase.stages)) - }) - } -} - func TestFreight_IsApprovedFor(t *testing.T) { const testStage = "fake-stage" freight := &Freight{} diff --git a/api/v1alpha1/warehouse_helpers_test.go b/api/v1alpha1/warehouse_helpers_test.go index 87a2862bb..03791c5f2 100644 --- a/api/v1alpha1/warehouse_helpers_test.go +++ b/api/v1alpha1/warehouse_helpers_test.go @@ -383,7 +383,7 @@ func TestWarehouse_ListFreight(t *testing.T) { VerifiedIn: []string{testUpstreamStage, testUpstreamStage2}, VerifiedBefore: &metav1.Time{Time: time.Now().Add(-1 * time.Hour)}, }, - assertions: func(t *testing.T, freight []Freight, err error) { + assertions: func(t *testing.T, _ []Freight, err error) { require.ErrorContains(t, err, "unsupported AvailabilityStrategy") }, },