MCPcopy
hub / github.com/akuity/kargo / TestDelete

Function TestDelete

pkg/conditions/conditions_test.go:501–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

499}
500
501func TestDelete(t *testing.T) {
502 const (
503 mockType1 = "MockType1"
504 mockType2 = "MockType2"
505 )
506
507 tests := []struct {
508 name string
509 setter *mockSetter
510 conditionType string
511 wantConditions []metav1.Condition
512 }{
513 {
514 name: "nil setter",
515 setter: nil,
516 conditionType: mockType1,
517 wantConditions: nil,
518 },
519 {
520 name: "empty condition type",
521 setter: &mockSetter{
522 conditions: []metav1.Condition{
523 {Type: mockType1, Status: metav1.ConditionTrue},
524 },
525 },
526 conditionType: "",
527 wantConditions: []metav1.Condition{
528 {Type: mockType1, Status: metav1.ConditionTrue},
529 },
530 },
531 {
532 name: "empty conditions",
533 setter: &mockSetter{
534 conditions: []metav1.Condition{},
535 },
536 conditionType: mockType1,
537 wantConditions: []metav1.Condition{},
538 },
539 {
540 name: "condition found and deleted",
541 setter: &mockSetter{
542 conditions: []metav1.Condition{
543 {Type: mockType1, Status: metav1.ConditionTrue},
544 },
545 },
546 conditionType: mockType1,
547 wantConditions: []metav1.Condition{},
548 },
549 {
550 name: "condition not found",
551 setter: &mockSetter{
552 conditions: []metav1.Condition{
553 {Type: mockType1, Status: metav1.ConditionTrue},
554 },
555 },
556 conditionType: mockType2,
557 wantConditions: []metav1.Condition{
558 {Type: mockType1, Status: metav1.ConditionTrue},

Callers

nothing calls this directly

Calls 3

DeleteFunction · 0.85
RunMethod · 0.65
GetConditionsMethod · 0.65

Tested by

no test coverage detected