|
9 | 9 | "fmt" |
10 | 10 | "reflect" |
11 | 11 | "testing" |
| 12 | + "time" |
12 | 13 |
|
13 | 14 | "github.com/stretchr/testify/assert" |
14 | 15 | "github.com/stretchr/testify/require" |
@@ -61,6 +62,36 @@ func TestCreateRunConfigFromMCPServer(t *testing.T) { |
61 | 62 | assert.Equal(t, 8080, config.Port) |
62 | 63 | }, |
63 | 64 | }, |
| 65 | + { |
| 66 | + name: "nil proxy read timeout leaves the RunConfig value empty", |
| 67 | + mcpServer: v1beta1test.NewMCPServer("nil-timeout-server", "test-ns"), |
| 68 | + //nolint:thelper // We want to see the error at the specific line |
| 69 | + expected: func(t *testing.T, config *runner.RunConfig) { |
| 70 | + assert.Empty(t, config.ProxyReadTimeout) |
| 71 | + }, |
| 72 | + }, |
| 73 | + { |
| 74 | + name: "zero proxy read timeout uses the proxy default", |
| 75 | + mcpServer: v1beta1test.NewMCPServer("zero-timeout-server", "test-ns", |
| 76 | + v1beta1test.Mutate(func(m *mcpv1beta1.MCPServer) { |
| 77 | + m.Spec.ProxyReadTimeout = &metav1.Duration{} |
| 78 | + })), |
| 79 | + //nolint:thelper // We want to see the error at the specific line |
| 80 | + expected: func(t *testing.T, config *runner.RunConfig) { |
| 81 | + assert.Empty(t, config.ProxyReadTimeout) |
| 82 | + }, |
| 83 | + }, |
| 84 | + { |
| 85 | + name: "positive proxy read timeout is translated", |
| 86 | + mcpServer: v1beta1test.NewMCPServer("positive-timeout-server", "test-ns", |
| 87 | + v1beta1test.Mutate(func(m *mcpv1beta1.MCPServer) { |
| 88 | + m.Spec.ProxyReadTimeout = &metav1.Duration{Duration: time.Minute} |
| 89 | + })), |
| 90 | + //nolint:thelper // We want to see the error at the specific line |
| 91 | + expected: func(t *testing.T, config *runner.RunConfig) { |
| 92 | + assert.Equal(t, "1m0s", config.ProxyReadTimeout) |
| 93 | + }, |
| 94 | + }, |
64 | 95 | { |
65 | 96 | name: "with environment variables", |
66 | 97 | mcpServer: v1beta1test.NewMCPServer("env-server", "test-ns", |
|
0 commit comments