Skip to content

Conversation

@ChrisJBurns
Copy link
Collaborator

@ChrisJBurns ChrisJBurns commented Jan 21, 2026

Summary

  • Add integration tests for MCPRemoteProxy controller basic functionality (Integration tests: MCPRemoteProxy Controller #3362)
  • Test Deployment, Service, ConfigMap, and RBAC resource creation
  • Test status condition tracking (Ready, Phase, URL, AuthConfigured)
  • Include test helpers with builder pattern for clean test setup

Test plan

Add comprehensive integration tests for the MCPRemoteProxy controller
covering basic functionality as outlined in issue #3362:

- Deployment creation and validation (labels, ServiceAccount, ports)
- Service creation and validation (labels, selectors, ports)
- ConfigMap (RunConfig) creation with content validation
- RBAC resource creation (ServiceAccount, Role, RoleBinding)
- Status condition tracking (Ready, Phase, ObservedGeneration, URL)
- AuthConfigured condition for valid OIDC config

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Jan 21, 2026
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.76%. Comparing base (546f5cb) to head (b292dc2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3376      +/-   ##
==========================================
- Coverage   64.82%   64.76%   -0.07%     
==========================================
  Files         375      375              
  Lines       36626    36626              
==========================================
- Hits        23744    23720      -24     
- Misses      11011    11035      +24     
  Partials     1871     1871              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Jan 21, 2026
@ChrisJBurns ChrisJBurns merged commit 8571282 into main Jan 21, 2026
35 checks passed
@ChrisJBurns ChrisJBurns deleted the adds-remote-proxy-int-tests branch January 21, 2026 21:23
Copy link
Contributor

@jerm-dro jerm-dro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +60 to +85
By("verifying the Deployment has correct labels")
Expect(deployment.Labels).To(HaveKeyWithValue("app", "mcpremoteproxy"))
Expect(deployment.Labels).To(HaveKeyWithValue("app.kubernetes.io/name", "mcpremoteproxy"))
Expect(deployment.Labels).To(HaveKeyWithValue("app.kubernetes.io/instance", proxy.Name))
Expect(deployment.Labels).To(HaveKeyWithValue("toolhive", "true"))
Expect(deployment.Labels).To(HaveKeyWithValue("toolhive-name", proxy.Name))

By("verifying the Deployment has correct spec")
Expect(deployment.Spec.Replicas).NotTo(BeNil())
Expect(*deployment.Spec.Replicas).To(Equal(int32(1)))

By("verifying the Deployment has correct selector labels")
Expect(deployment.Spec.Selector.MatchLabels).To(HaveKeyWithValue("app", "mcpremoteproxy"))
Expect(deployment.Spec.Selector.MatchLabels).To(HaveKeyWithValue("toolhive-name", proxy.Name))

By("verifying the pod template has correct labels")
Expect(deployment.Spec.Template.Labels).To(HaveKeyWithValue("app", "mcpremoteproxy"))
Expect(deployment.Spec.Template.Labels).To(HaveKeyWithValue("toolhive", "true"))

By("verifying the container configuration")
Expect(deployment.Spec.Template.Spec.Containers).To(HaveLen(1))
container := deployment.Spec.Template.Spec.Containers[0]
Expect(container.Name).To(Equal("toolhive"))
Expect(container.Ports).To(HaveLen(1))
Expect(container.Ports[0].ContainerPort).To(Equal(int32(8080)))
Expect(container.Ports[0].Name).To(Equal("http"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, non-blocking: are there helper functions that would allow these assertions to be more declarative?

Ideally, we'd write Expect(actualDeployment).To(Equal(expectedDeployments), so the tests are less gingko boilerplate.

Comment on lines +100 to +103

By("verifying the Deployment uses the correct ServiceAccount")
expectedServiceAccountName := fmt.Sprintf("%s-remote-proxy-runner", proxy.Name)
Expect(deployment.Spec.Template.Spec.ServiceAccountName).To(Equal(expectedServiceAccountName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, non-blocking: You could just pull these lines up to the test above. No need to create a brand new Deployment.

Comment on lines +141 to +154
By("verifying the Service has correct labels")
Expect(service.Labels).To(HaveKeyWithValue("app", "mcpremoteproxy"))
Expect(service.Labels).To(HaveKeyWithValue("app.kubernetes.io/name", "mcpremoteproxy"))
Expect(service.Labels).To(HaveKeyWithValue("app.kubernetes.io/instance", proxy.Name))
Expect(service.Labels).To(HaveKeyWithValue("toolhive", "true"))

By("verifying the Service port configuration")
Expect(service.Spec.Ports).To(HaveLen(1))
Expect(service.Spec.Ports[0].Port).To(Equal(int32(8080)))
Expect(service.Spec.Ports[0].Name).To(Equal("http"))

By("verifying the Service selector")
Expect(service.Spec.Selector).To(HaveKeyWithValue("app", "mcpremoteproxy"))
Expect(service.Spec.Selector).To(HaveKeyWithValue("toolhive-name", proxy.Name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Again, these assertions could be made on the MCPRemoteProxy from line 49.


// NewRemoteProxyBuilder creates a new MCPRemoteProxy builder with sensible defaults
// for required fields (RemoteURL, OIDCConfig) so tests only need to override what they're testing
func (h *MCPRemoteProxyTestHelper) NewRemoteProxyBuilder(name string) *RemoteProxyBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion, feel free to ignore: you might be able to get rid of these helpers if you reuse the MCPRemoteProxy for more tests. That would also improve test readibility. For example, for one of the tests, I wondered "where does 'remote.example.com' come from?"

RunSpecs(t, "MCPRemoteProxy Controller Integration Test Suite", suiteConfig, reporterConfig)
}

var _ = BeforeSuite(func() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, for my education: do we really have to redefine these for every directory in test-integration? How could we avoid doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants