(t *testing.T)
| 617 | } |
| 618 | |
| 619 | func TestBuildTable(t *testing.T) { |
| 620 | tests := []struct { |
| 621 | name string |
| 622 | namespace string |
| 623 | reader io.Reader |
| 624 | count int |
| 625 | err bool |
| 626 | }{ |
| 627 | { |
| 628 | name: "Valid input", |
| 629 | namespace: "test", |
| 630 | reader: strings.NewReader(guestbookManifest), |
| 631 | count: 6, |
| 632 | }, { |
| 633 | name: "Valid input, deploying resources into different namespaces", |
| 634 | namespace: "test", |
| 635 | reader: strings.NewReader(namespacedGuestbookManifest), |
| 636 | count: 1, |
| 637 | }, |
| 638 | } |
| 639 | |
| 640 | c := newTestClient(t) |
| 641 | for _, tt := range tests { |
| 642 | t.Run(tt.name, func(t *testing.T) { |
| 643 | // Test for an invalid manifest |
| 644 | infos, err := c.BuildTable(tt.reader, false) |
| 645 | if err != nil && !tt.err { |
| 646 | t.Errorf("Got error message when no error should have occurred: %v", err) |
| 647 | } else if err != nil && strings.Contains(err.Error(), "--validate=false") { |
| 648 | t.Error("error message was not scrubbed") |
| 649 | } |
| 650 | |
| 651 | if len(infos) != tt.count { |
| 652 | t.Errorf("expected %d result objects, got %d", tt.count, len(infos)) |
| 653 | } |
| 654 | }) |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | func TestPerform(t *testing.T) { |
| 659 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…