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

Build PTY test image #101

Merged
merged 2 commits into from
May 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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