Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Improvements around docker in Playwright #12261

Merged
merged 10 commits into from
Feb 20, 2024
Merged

Conversation

t3chguy
Copy link
Member

@t3chguy t3chguy commented Feb 19, 2024

Split out from #12252

Review commit-by-commit

@t3chguy t3chguy added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Feb 19, 2024
@t3chguy t3chguy self-assigned this Feb 19, 2024
@t3chguy t3chguy marked this pull request as ready for review February 19, 2024 15:59
@t3chguy t3chguy requested a review from a team as a code owner February 19, 2024 15:59
playwright/plugins/postgres/index.ts Outdated Show resolved Hide resolved
playwright/plugins/docker/index.ts Outdated Show resolved Hide resolved
playwright/plugins/docker/index.ts Outdated Show resolved Hide resolved
Comment on lines 33 to 34
process.stdout.write(log);
process.stderr.write(log);
Copy link
Member

Choose a reason for hiding this comment

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

do we really need to log this twice? seems like it will be confusing to me.

Copy link
Member Author

@t3chguy t3chguy Feb 20, 2024

Choose a reason for hiding this comment

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

Its so you know in both log files which command a given line corresponds to, docker command output is not very descriptive and sometimes is just opaque IDs which are impossible to associate with the command issued.

Copy link
Member

Choose a reason for hiding this comment

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

... which is maybe ok if they are going to log files, but not so much if they aren't.

[It feels like the problem here is that we have different logfiles for stdout and stderr in the first place. Does it even make sense for the stdout of a random docker command to end up in a different logfile to its stderr?]

Anyway fine let's not deal with that problem today. Write a comment saying that it's to deal with the case of having two logfiles, and move on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Playwright is the thing moving the process stdout/stderr into a file with seemingly no way to combine them, having a separate stdout/stderr file for the commands we run vs the rest of playwright will end up even more painful IMO

Copy link
Member

Choose a reason for hiding this comment

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

Empirically they aren't going to a file when I run this at the commandline, but anyway this isn't a thing worth stressing over now.

Copy link
Member Author

@t3chguy t3chguy Feb 20, 2024

Choose a reason for hiding this comment

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

I guess they go into a file if you run with the HTML reporter, like we do in CI

playwright/plugins/docker/index.ts Outdated Show resolved Hide resolved
playwright/plugins/docker/index.ts Outdated Show resolved Hide resolved
Signed-off-by: Michael Telatynski <[email protected]>
Signed-off-by: Michael Telatynski <[email protected]>
@richvdh
Copy link
Member

richvdh commented Feb 20, 2024

When I run this at the commandline I see this:

rav@xps9320:~/work/matrix-react-sdk (t3chguy/tidy-playwright-2 $%=)$ playwright test

Running 778 tests using 1 worker
[Legacy Crypto] › audio-player/audio-player.spec.ts:141:9 › Audio player › should be correctly rendered - light theme
Copy /home/rav/work/matrix-react-sdk/playwright/plugins/homeserver/synapse/templates/default -> /tmp/react-sdk-synapsedocker-Omef4C
Gen /home/rav/work/matrix-react-sdk/playwright/plugins/homeserver/synapse/templates/default/homeserver.yaml -> /tmp/react-sdk-synapsedocker-Omef4C/homeserver.yaml
Gen -> /tmp/react-sdk-synapsedocker-Omef4C/localhost.signing.key
Starting synapse with config dir /tmp/react-sdk-synapsedocker-Omef4C...
Running command: docker --help 
Running command: docker --help 

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Common Commands:
  run         Create and run a new container from an image
  exec        Execute a command in a running container
  ps          List containers
  build       Build an image from a Dockerfile
  pull        Download an image from a registry
  push        Upload an image to a registry
  images      List images
  login       Log in to a registry
  logout      Log out from a registry
  search      Search Docker Hub for images
  version     Show the Docker version information
  info        Display system-wide information

Management Commands:
  builder     Manage builds
  buildx*     Docker Buildx (Docker Inc., v0.12.1)
  checkpoint  Manage checkpoints
  compose*    Docker Compose (Docker Inc., v2.24.5)
  container   Manage containers
  context     Manage contexts
  image       Manage images
  manifest    Manage Docker image manifests and manifest lists
  network     Manage networks
  plugin      Manage plugins
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Swarm Commands:
  swarm       Manage Swarm

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  import      Import the contents from a tarball to create a filesystem image
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  wait        Block until one or more containers stop, then print their exit codes

Global Options:
      --config string      Location of client config files (default
                           "/home/rav/.docker")
  -c, --context string     Name of the context to use to connect to the
                           daemon (overrides DOCKER_HOST env var and
                           default context set with "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket to connect to
  -l, --log-level string   Set the logging level ("debug", "info",
                           "warn", "error", "fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default
                           "/home/rav/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default
                           "/home/rav/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default
                           "/home/rav/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Run 'docker COMMAND --help' for more information on a command.

For more help on how to use Docker, head to https://docs.docker.com/go/guides/


Running command: docker run --name react-sdk-playwright-synapse-608267e4 -d --rm -v /tmp/react-sdk-synapsedocker-Omef4C:/data -p 39379:8008/tcp -u 1000:1000 --add-host host.containers.internal:host-gateway matrixdotorg/synapse:develop run 
Running command: docker run --name react-sdk-playwright-synapse-608267e4 -d --rm -v /tmp/react-sdk-synapsedocker-Omef4C:/data -p 39379:8008/tcp -u 1000:1000 --add-host host.containers.internal:host-gateway matrixdotorg/synapse:develop run 
e3b76d7f68b964fcf2c3f2a299b5b884f7cb8f0243b9087749fa4afc5c4e1651


Started synapse with id e3b76d7f68b964fcf2c3f2a299b5b884f7cb8f0243b9087749fa4afc5c4e1651 on port 39379.
Running command: docker exec e3b76d7f68b964fcf2c3f2a299b5b884f7cb8f0243b9087749fa4afc5c4e1651 curl --connect-timeout 30 --retry 30 --retry-delay 1 --retry-all-errors --silent http://localhost:8008/health 
Running command: docker exec e3b76d7f68b964fcf2c3f2a299b5b884f7cb8f0243b9087749fa4afc5c4e1651 curl --connect-timeout 30 --retry 30 --retry-delay 1 --retry-all-errors --silent http://localhost:8008/health 
OK

... which I would say is Too Verbose.

@t3chguy
Copy link
Member Author

t3chguy commented Feb 20, 2024

Oh yes, podman check also had pipe=false, will revert that behaviour

@t3chguy
Copy link
Member Author

t3chguy commented Feb 20, 2024

Yeah I guess the Running command: for local runs is a bit too noisy, will tweak for CI

Signed-off-by: Michael Telatynski <[email protected]>
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm. Thanks for cleaning it up, and for your perseverance!

playwright/plugins/docker/index.ts Outdated Show resolved Hide resolved
Signed-off-by: Michael Telatynski <[email protected]>
Signed-off-by: Michael Telatynski <[email protected]>
@t3chguy t3chguy added this pull request to the merge queue Feb 20, 2024
Merged via the queue into develop with commit a9add45 Feb 20, 2024
22 checks passed
@t3chguy t3chguy deleted the t3chguy/tidy-playwright-2 branch February 20, 2024 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants