Skip to content

Local docker run - #1338

Open
sonic16x wants to merge 18 commits into
masterfrom
local-docker-run
Open

sonic16x wants to merge 18 commits into
masterfrom
local-docker-run

Conversation

@sonic16x

Copy link
Copy Markdown
Contributor

No description provided.

@sonic16x
sonic16x force-pushed the local-docker-run branch 2 times, most recently from 31261e5 to 4b60012 Compare October 1, 2026 03:17
@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1338

commit: ab96268

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@sonic16x
sonic16x force-pushed the local-docker-run branch 3 times, most recently from d364192 to 98520eb Compare October 1, 2026 05:19

@DudaGod DudaGod 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.

Я посмотрел локальный запуск браузеров в Docker. Ниже построчные замечания по совместимости образов, сети, безопасности и удобству запуска.

Comment thread src/browser/new-browser.ts Outdated
this._sessionIdForLogs = session.sessionId;
this._wdProcess?.setSessionId?.(session.sessionId);
const debuggerAddress = session.capabilities["goog:chromeOptions"]?.debuggerAddress;
if (debuggerAddress && !("browserWSEndpoint" in this._config && this._config.browserWSEndpoint)) {

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.

Я бы не делал подготовку CDP обязательной при создании WebDriver-сессии. Пользовательский Chrome-образ может вернуть debuggerAddress, но не иметь devtools-адаптера, которого ожидает prepareCdp(). Тогда даже тест, использующий только WebDriver, не стартует. Можно ли инициализировать CDP только при первом обращении к нему?

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.

Поправил

Comment thread src/browser/docker.ts Outdated
import { prepareDockerBrowserImage } from "./docker-image";
import { timeDockerOperation } from "./docker-timing";

const PLATFORM = "linux/amd64";

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.

Здесь жёстко задан linux/amd64, поэтому на Apple Silicon нативный arm64-образ будет отвергнут, а multi-platform образ запустится через эмуляцию. Я бы выбирал архитектуру текущего Docker-движка, сохранив возможность явно запросить другую платформу.

@sonic16x sonic16x Oct 20, 2026 •

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.

добавил возможность указывать параметром, но по дефолту такой

Comment thread src/browser/docker.ts Outdated
await writeFile(configPath, JSON.stringify(browsers));
// Set before creation to also clean up when the CLI times out after creating the network.
networkCreated = true;
await timeDockerOperation(name, "create network", () => docker(["network", "create", network]));

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.

Я бы проверил IPv6 именно в создаваемой здесь сети. Включённый IPv6 у стандартного bridge не означает, что новая пользовательская сеть тоже получит IPv6. Сейчас браузерный контейнер может не открыть IPv6-only сайт, хотя сама VM имеет к нему доступ.

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.

Добавил --ipv6 флаг

Comment thread src/browser/docker.ts Outdated
network,
// This is the socket path on the daemon's Linux host, including Docker Desktop/Colima.
"--volume",
"/var/run/docker.sock:/var/run/docker.sock",

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.

/var/run/docker.sock — путь на стороне Docker-демона, а не сокет из выбранного локального Docker context. У rootless Podman он обычно находится в другом месте, поэтому описанный в документации сценарий может не запустить Selenoid. Я бы добавил настройку способа подключения контроллера к движку и проверку этого сценария.

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.

по умолчанию такой, но добавил возможность менять через параметр

Comment thread src/browser/docker.ts Outdated
...controllerSecurityArgs,
selenoidImage,
"-conf",
"/browsers.json",

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.

Я бы передавал Selenoid -disable-privileged по умолчанию. Без этого флага он запускает браузерные контейнеры в privileged-режиме, а здесь пользователь может указать произвольный образ. Если отдельным образам нужны дополнительные привилегии, лучше включать их явно.

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.

Добавил

Comment thread src/browser/docker.ts Outdated
}

const { selenoidImage } = config || {};
if (typeof selenoidImage !== "string" || !selenoidImage.trim()) {

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.

Я бы не требовал от пользователя выбирать selenoidImage для базового сценария. Его цель — указать свой совместимый браузерный образ и запустить тесты; образ контроллера выглядит внутренней деталью Testplane. Можно ли дать публичный закреплённый default и оставить это поле для переопределения?

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.

пока так, мы пока не запушили публичный образ селеноида

Comment thread src/browser/docker-manager.ts Outdated
const manager = runs.get(owner);
if (manager) return manager.acquire(browserId, config, options, closeBrowser);

await standaloneStopping;

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.

Если state.manager.stop() отклонится, standaloneStopping навсегда останется отклонённым Promise. После временного сбоя Docker любой следующий standalone-запуск упадёт на этом await. Я бы очищал состояние после ошибки и добавил тест на повторный запуск.

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.

Поправил

Comment thread test/src/browser/docker.ts Outdated

it("should route Firefox sessions through /wd/hub inside the browser container", async () => {
const driver = await start(
"registry.yandex.net/selenium/firefox:148.0",

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.

Я бы заменил адрес внутреннего registry в публичном тесте на нейтральный фикстурный адрес. Для проверки маршрута /wd/hub конкретный реестр не нужен.

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.

поправил

Comment thread docs/docker.md Outdated

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.

This is a wrong place to add docs. I think we'll remove the docs/ directory in the near future. Docs should live on testplane.io and we've put a lot of effort into this migration.

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.

Removed

...desiredCapabilities,
},
gridUrl: options.gridUrl || LOCAL_GRID_URL,
docker: options.docker,

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.

I would think once again about the "docker" naming. Are we sure in this one?

For example, let's imagine that we'll need to support podman (a very real possibility). What will we do in that case? Add another podman field that would duplicate all the logic?

Perhaps it's not a problem. But I would seriously consider this possibility & make sure this design is future-proof in this sense.

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.

keep docker, because it is obvious name

@shadowusr

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T23:21:29.459826Z ab96268 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 97832f8f38

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/runner/index.ts Resolved
Comment thread src/browser-backend/docker/index.ts Resolved

@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: ab96268ac9

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

this._sampleState(queued.browserConfig.id);

this._newBrowser(queued.id, queued.opts).then(queued.resolve, queued.reject);
this._newBrowser(queued.browserConfig, queued.opts).then(queued.resolve, queued.reject);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the queued request's test context before launching

When a browser request is queued behind a pool limit, _launchNextBrowser() runs inside the context of the test releasing the previous browser, rather than the queued test's context. Since request headers now come from getTestContext(), the queued test's session creation and SESSION_START requests receive the previous test's X-Request-ID prefix and traceparent. This incorrectly associates those requests with another test's diagnostics. Reproducing with a one-slot LimitedPool and contexts A and B yields A for both underlying launches. Capture the context when enqueueing and restore it when executing the queued launch.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants