(t *testing.T)
| 695 | } |
| 696 | |
| 697 | func TestRunAttachFlag(t *testing.T) { |
| 698 | testCase := nerdtest.Setup() |
| 699 | testCase.Require = require.Not(require.Windows) |
| 700 | |
| 701 | type attachTC struct { |
| 702 | description string |
| 703 | args []string |
| 704 | useStdin bool |
| 705 | isError bool |
| 706 | testStr string |
| 707 | expectedOut string |
| 708 | dockerOut string |
| 709 | } |
| 710 | |
| 711 | tcs := []attachTC{ |
| 712 | { |
| 713 | description: "AttachFlagStdin", |
| 714 | args: []string{"-a", "STDIN", "-a", "STDOUT"}, |
| 715 | useStdin: true, |
| 716 | testStr: "test-run-stdio", |
| 717 | expectedOut: "test-run-stdio", |
| 718 | dockerOut: "test-run-stdio", |
| 719 | }, |
| 720 | { |
| 721 | description: "AttachFlagStdOut", |
| 722 | args: []string{"-a", "STDOUT"}, |
| 723 | testStr: "foo", |
| 724 | expectedOut: "foo", |
| 725 | dockerOut: "foo", |
| 726 | }, |
| 727 | { |
| 728 | description: "AttachFlagMixedValue", |
| 729 | args: []string{"-a", "STDIN", "-a", "invalid-value"}, |
| 730 | isError: true, |
| 731 | testStr: "foo", |
| 732 | expectedOut: "invalid stream specified with -a flag. Valid streams are STDIN, STDOUT, and STDERR", |
| 733 | dockerOut: "valid streams are STDIN, STDOUT and STDERR", |
| 734 | }, |
| 735 | { |
| 736 | description: "AttachFlagInvalidValue", |
| 737 | args: []string{"-a", "invalid-stream"}, |
| 738 | isError: true, |
| 739 | testStr: "foo", |
| 740 | expectedOut: "invalid stream specified with -a flag. Valid streams are STDIN, STDOUT, and STDERR", |
| 741 | dockerOut: "valid streams are STDIN, STDOUT and STDERR", |
| 742 | }, |
| 743 | { |
| 744 | description: "AttachFlagCaseInsensitive", |
| 745 | args: []string{"-a", "stdin", "-a", "stdout"}, |
| 746 | useStdin: true, |
| 747 | testStr: "test-run-stdio", |
| 748 | expectedOut: "test-run-stdio", |
| 749 | dockerOut: "test-run-stdio", |
| 750 | }, |
| 751 | } |
| 752 | |
| 753 | for _, tc := range tcs { |
| 754 | testCase.SubTests = append(testCase.SubTests, &test.Case{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…