Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for device passthrough #277

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Include HostConfig/Devices in test framework
Additionally some string formatting issues were fixed to allow the tests to run against go 1.10
martin31821 committed Feb 28, 2018

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 879795b1e95d679679122589aade4046cc3e9d27
9 changes: 9 additions & 0 deletions generator_test.go
Original file line number Diff line number Diff line change
@@ -95,6 +95,15 @@ func TestGenerateFromEvents(t *testing.T) {
Ports: map[docker.Port][]docker.PortBinding{},
},
ResolvConfPath: "/etc/resolv.conf",
HostConfig: &docker.HostConfig{
Devices: []docker.Device{
docker.Device{
PathOnHost: "/dev/ttyACM0",
PathInContainer: "/dev/ttyUSB0",
CgroupPermissions: "rwm",
},
},
},
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
8 changes: 4 additions & 4 deletions template_test.go
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ func TestKeysEmpty(t *testing.T) {
}

if len(input) != vk.Len() {
t.Fatalf("Incorrect key count; expected %s, got %s", len(input), vk.Len())
t.Fatalf("Incorrect key count; expected %d, got %d", len(input), vk.Len())
}
}

@@ -269,11 +269,11 @@ func TestGroupByMulti(t *testing.T) {
}

if len(groups["demo1.localhost"]) != 2 {
t.Fatalf("expected 2 got %s", len(groups["demo1.localhost"]))
t.Fatalf("expected 2 got %d", len(groups["demo1.localhost"]))
}

if len(groups["demo2.localhost"]) != 1 {
t.Fatalf("expected 1 got %s", len(groups["demo2.localhost"]))
t.Fatalf("expected 1 got %d", len(groups["demo2.localhost"]))
}
if groups["demo2.localhost"][0].(RuntimeContainer).ID != "3" {
t.Fatalf("expected 2 got %s", groups["demo2.localhost"][0].(RuntimeContainer).ID)
@@ -785,7 +785,7 @@ func TestJson(t *testing.T) {
t.Fatal(err)
}
if len(decoded) != len(containers) {
t.Fatal("Incorrect unmarshaled container count. Expected %d, got %d.", len(containers), len(decoded))
t.Fatalf("Incorrect unmarshaled container count. Expected %d, got %d.", len(containers), len(decoded))
}
}

4 changes: 2 additions & 2 deletions utils_test.go
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ func TestDockerHostEndpoint(t *testing.T) {

endpoint, err := GetEndpoint("")
if err != nil {
t.Fatal("%s", err)
t.Fatalf("%s", err)
}

if endpoint != "tcp://127.0.0.1:4243" {
@@ -48,7 +48,7 @@ func TestDockerFlagEndpoint(t *testing.T) {
// flag value should override DOCKER_HOST and default value
endpoint, err := GetEndpoint("tcp://127.0.0.1:5555")
if err != nil {
t.Fatal("%s", err)
t.Fatalf("%s", err)
}
if endpoint != "tcp://127.0.0.1:5555" {
t.Fatalf("Expected tcp://127.0.0.1:5555, got %s", endpoint)