(t *testing.T)
| 657 | } |
| 658 | } |
| 659 | |
| 660 | func TestAdaptEntrypoint_Windows(t *testing.T) { |
| 661 | testCases := []struct { |
| 662 | name string |
| 663 | cmd []string |
| 664 | scriptCmd []string |
| 665 | want []string |
| 666 | }{ |
| 667 | { |
| 668 | name: "gunicorn_windows", |
| 669 | cmd: []string{"gunicorn", "-b", ":8080", "main:app"}, |
| 670 | want: []string{"python", "lib\\bin\\gunicorn", "-b", ":8080", "main:app"}, |
| 671 | }, |
| 672 | { |
| 673 | name: "uvicorn_windows", |
| 674 | cmd: []string{"uvicorn", "main:app", "--port", "8080", "--host", "0.0.0.0"}, |
| 675 | want: []string{"python", "lib\\bin\\uvicorn", "main:app", "--port", "8080", "--host", "0.0.0.0"}, |
| 676 | }, |
| 677 | } |
| 678 | |
| 679 | for _, tc := range testCases { |
| 680 | t.Run(tc.name, func(t *testing.T) { |
| 681 | ctx := gcp.NewContext(gcp.WithCapability(EntrypointAdapterCapability, &MakerEntrypointAdapter{TargetPlatform: "windows/amd64"})) |
| 682 | got, err := AdaptEntrypoint(ctx, tc.cmd, tc.scriptCmd) |
| 683 | if err != nil { |
| 684 | t.Fatalf("AdaptEntrypoint(%v) failed: %v", tc.cmd, err) |
| 685 | } |
| 686 | if diff := cmp.Diff(tc.want, got); diff != "" { |
| 687 | t.Errorf("AdaptEntrypoint(%v) returned diff (-want +got):\n%s", tc.cmd, diff) |
| 688 | } |
| 689 | }) |
| 690 | } |
| 691 | } |
| 692 | |
| 693 | func TestCommand(t *testing.T) { |
nothing calls this directly
no test coverage detected