(t *testing.T)
| 578 | } |
| 579 | |
| 580 | func TestBuild(t *testing.T) { |
| 581 | tests := []struct { |
| 582 | name string |
| 583 | namespace string |
| 584 | reader io.Reader |
| 585 | count int |
| 586 | err bool |
| 587 | }{ |
| 588 | { |
| 589 | name: "Valid input", |
| 590 | namespace: "test", |
| 591 | reader: strings.NewReader(guestbookManifest), |
| 592 | count: 6, |
| 593 | }, { |
| 594 | name: "Valid input, deploying resources into different namespaces", |
| 595 | namespace: "test", |
| 596 | reader: strings.NewReader(namespacedGuestbookManifest), |
| 597 | count: 1, |
| 598 | }, |
| 599 | } |
| 600 | |
| 601 | c := newTestClient(t) |
| 602 | for _, tt := range tests { |
| 603 | t.Run(tt.name, func(t *testing.T) { |
| 604 | // Test for an invalid manifest |
| 605 | infos, err := c.Build(tt.reader, false) |
| 606 | if err != nil && !tt.err { |
| 607 | t.Errorf("Got error message when no error should have occurred: %v", err) |
| 608 | } else if err != nil && strings.Contains(err.Error(), "--validate=false") { |
| 609 | t.Error("error message was not scrubbed") |
| 610 | } |
| 611 | |
| 612 | if len(infos) != tt.count { |
| 613 | t.Errorf("expected %d result objects, got %d", tt.count, len(infos)) |
| 614 | } |
| 615 | }) |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | func TestBuildTable(t *testing.T) { |
| 620 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…