Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #101 from Netflix/add-pty-test
Browse files Browse the repository at this point in the history
Build PTY test image
  • Loading branch information
sargun committed May 7, 2018
2 parents 2dcdf3d + 71ef8b4 commit e0508b3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- run: ./build.sh ubuntu-systemd-xenial
- run: ./build.sh no-entrypoint
- run: ./build.sh ignore-signals
- run: ./build.sh pty
ci-builder:
docker:
- image: docker:17.05.0-ce-git
Expand Down
17 changes: 17 additions & 0 deletions executor/mock/standalone/standalone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ var (
name: "titusoss/ignore-signals",
tag: "20180501-1525157636",
}
pty = testImage{
name: "titusoss/pty",
tag: "20180507-1525733149",
}
)

// This file still uses log as opposed to using the testing library's built-in logging framework.
Expand Down Expand Up @@ -88,6 +92,7 @@ func TestStandalone(t *testing.T) {
testMetadataProxyInjection,
testMetdataProxyDefaultRoute,
testTerminateTimeout,
testMakesPTY,
}
for _, fun := range testFunctions {
fullName := runtime.FuncForPC(reflect.ValueOf(fun).Pointer()).Name()
Expand Down Expand Up @@ -208,6 +213,18 @@ func testDefaultCapabilities(t *testing.T, jobID string) {
}
}

func testMakesPTY(t *testing.T, jobID string) {
ji := &mock.JobInput{
ImageName: pty.name,
Version: pty.tag,
Entrypoint: "/bin/bash -c '/usr/bin/unbuffer /usr/bin/tty | grep /dev/pts'",
JobID: jobID,
}
if !mock.RunJobExpectingSuccess(ji, false) {
t.Fail()
}
}

func testStdoutGoesToLogFile(t *testing.T, jobID string) {
message := fmt.Sprintf("Some message with ID=%s, and a suffix.", uuid.New())
cmd := fmt.Sprintf(`sh -c 'echo "%[1]s" && sleep 1 && grep "%[1]s" /logs/stdout'`, message)
Expand Down
2 changes: 2 additions & 0 deletions hack/test-images/pty/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM ubuntu:xenial
RUN apt-get update && apt-get install -y expect coreutils

0 comments on commit e0508b3

Please sign in to comment.