Skip to content

Connect: add e2e tests for kube access - #65929

Merged
gzdunek merged 19 commits into
masterfrom
gzdunek/e2e-kube
Aug 13, 2026
Merged

Connect: add e2e tests for kube access #65929
gzdunek merged 19 commits into
masterfrom
gzdunek/e2e-kube

Conversation

@gzdunek

@gzdunek gzdunek commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

The kube cluster is provided using https://kind.sigs.k8s.io/, and setting it up takes about 10 seconds on my machine. The kube service runs as part of the main Teleport process.

Manual Test Plan

Test Environment

pnpm start-teleport

Test Cases

  • After a minor layout changes, the unified view looks the same as before.

@gzdunek gzdunek added the no-changelog Indicates that a PR does not require a changelog entry label Apr 20, 2026
@gzdunek
gzdunek requested review from ravicious and ryanclark April 20, 2026 11:30
@socket-security

socket-security Bot commented Apr 20, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgolang/​sigs.k8s.io/​kind@​v0.32.093100100100100

View full report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c44ef78702

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread e2e/tests/connect/kube.spec.ts Outdated
Comment thread e2e/tests/connect/kube.spec.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7be48d178f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread e2e/runner/main.go Outdated
Comment thread e2e/runner/kube.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10b4bf2ea2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread e2e/runner/main.go

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4277ef7288

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread e2e/tests/connect/kube.spec.ts Outdated
@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

+ 61 passed
- 1 failed
! 1 flaky
# 5 skipped
# 2m 42s

Failures

[connect] e2e/tests/connect/stateRestoration.spec.ts:153

logout clears previous tabs

Error: expect(locator).toBeVisible() failed

Locator: getByPlaceholder('Search or jump to')
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" with timeout 5000ms
  - waiting for getByPlaceholder('Search or jump to')


   at ../helpers/connect.ts:118

  116 |   await page.getByPlaceholder('Password').fill(password);
  117 |   await page.getByRole('button', { name: 'Sign In' }).click();
> 118 |   await expect(page.getByPlaceholder('Search or jump to')).toBeVisible();
      |                                                            ^
  119 | }
  120 |
  121 | export interface App {
    at login (/__w/teleport/teleport/e2e/helpers/connect.ts:118:60)
    at /__w/teleport/teleport/e2e/tests/connect/stateRestoration.spec.ts:177:5

Retry #1 failed with a different error:


Flaky

[connect] e2e/tests/connect/stateRestoration.spec.ts:78

relaunch restores tabs


View full report
./e2e/run.sh --report 65929 --sha 96e43606

Comment thread e2e/runner/kube.go
return nil
}

func rewriteKubeconfigServerHost(kubeconfigPath, targetHost string) error {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not an expert in Docker networking, so maybe I missed a simpler way.

The issue is that by default kind writes kubeconfig with an API server endpoint like https://127.0.0.1:<port>. That works fine when Teleport runs on the same host.
However, in CI, Teleport runs in a different container, so 127.0.0.1 resolves to Teleport's own loopback, not the kind API server.
A workaround is to rewrite kubeconfig to use a reachable host.

@gzdunek

gzdunek commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

The failure at [connect] e2e/tests/connect/stateRestoration.spec.ts:150 is due to hitting the login rate limit. I'll address that separately.

@gzdunek
gzdunek requested a review from ravicious April 22, 2026 14:21
gzdunek added 2 commits May 21, 2026 16:00
# Conflicts:
#	e2e/config/state.yaml.tmpl
#	e2e/runner/go.mod
#	e2e/runner/teleport.go
@gzdunek

gzdunek commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

@ravicious @ryanclark I've resolved conflicts, please take a look when you get a chance

@ryanclark ryanclark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

const kubeResourceName = /teleport-e2e-kube-/i;
const kubePromptText = 'Try "kubectl version" to test the connection.';

async function openKubeTerminal(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be a method on one of the pages instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think there's no good place to move it:

  • connectWithoutLogin belongs to UnifiedResourcesPage.
  • waitForText belongs to TerminalPage.

We would need a page that depends on both. I think it's fine to keep this function here until we need it in another place.

Comment thread e2e/tests/connect/kube.spec.ts Outdated
await openKubeTerminal(resources, terminal);

const kubectlRunOutput = await terminal.execAndWait(
`${kubectlCommand} run ${podName} --image=busybox:1.37.0 --command -- sh -c 'sleep 3600'`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Won't this make each test run download a new image on every run? It'd be best to use something less intrusive if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah it could make this test flaky. I replaced pulling an image with exec into kind's internal pod.

# Conflicts:
#	e2e/README.md
#	e2e/helpers/fixtures.ts
#	e2e/helpers/pages/UnifiedResources.ts
#	e2e/runner/fixtures/fixtures.go
#	e2e/runner/go.mod
#	e2e/runner/go.sum
#	e2e/runner/instance.go
#	e2e/runner/main.go
@gzdunek

gzdunek commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

The failure at [connect] e2e/tests/connect/stateRestoration.spec.ts:150 is due to hitting the login rate limit. I'll address that separately.

Unfortunately, I didn't have a chance to look into this, so I disabled the tests for now. I left a TODO for myself to (hopefully) re-enable them soon.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74f0fa8871

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread e2e/tests/connect/kube.spec.ts Outdated
@gzdunek
gzdunek enabled auto-merge August 13, 2026 09:21
@gzdunek
gzdunek added this pull request to the merge queue Aug 13, 2026
Merged via the queue into master with commit 25a7be0 Aug 13, 2026
50 checks passed
@gzdunek
gzdunek deleted the gzdunek/e2e-kube branch August 13, 2026 10:34
tscolari added a commit that referenced this pull request Aug 13, 2026
…app-access-tbot

* origin/master: (118 commits)
  Connect: add e2e tests for kube access  (#65929)
  docs: Add 'sudo' to teleport-update uninstall command (#69618)
  MWI: issuance: Add UsageApp support to IssueScopedBotCerts (#69449)
  Fix TestNewWebSessionScopedTrustedDeviceRequirement flakiness (#69506)
  Deprecate recording of join metadata into bot instance record (#69571)
  Terraform: convert auto update version to generic provider (#69514)
  docs: entra id metrics (#69343)
  auth: Add v9 downgrade property tests (#68916)
  docs: address codex feedback for username trait in PingFederate role (#69589)
  Terraform: convert ui config to generic provider (#69507)
  waiting for kube server to land in unified resource cache before proceeding with test cases (#69619)
  Implement tctl observability (#67904)
  IAC SSH Server Namespacing support (#69542)
  Remove Firestore key migration (#69590)
  tfgen: support generating top-level access list scope field (#69337)
  mark bloat binary builds as dev builds so they do not require keys (#69609)
  Fix improper userca.pem concatenation by kinitProvider (#69582)
  Terraform: convert recording config to generic provider (#69491)
  Terraform: convert classifier to generic provider (#69423)
  Fix `teleport-investigate` and `teleport-access-review` skill inaccuracies  (#69309)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/md ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants