Skip to content

Commit

Permalink
Update unit tests to pass v1.1 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeckman314 committed May 31, 2023
1 parent 95aacd7 commit ce4271c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"request": "launch",
"mode": "auto",
"program": "main.go",
"args": ["task", "list", "--tag", "foo=bar"],
"args": ["server", "run"],
},
{
"name": "Attach to Process",
Expand Down
8 changes: 4 additions & 4 deletions cmd/task/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestGetDefaultView(t *testing.T) {
func TestList(t *testing.T) {
cmd, h := newCommandHooks()

h.List = func(server, view, page, state string, tags []string, size int32, all bool, w io.Writer) error {
h.List = func(server, view, page, state string, tags []string, namePrefix string, size int32, all bool, w io.Writer) error {
if view != "FULL" {
t.Errorf("expected FULL view, got '%s'", view)
}
Expand All @@ -62,7 +62,7 @@ func TestServerDefault(t *testing.T) {
}
return nil
}
h.List = func(server, view, page, state string, tags []string, size int32, all bool, w io.Writer) error {
h.List = func(server, view, page, state string, tags []string, namePrefix string, size int32, all bool, w io.Writer) error {
if server != "http://localhost:8000" {
t.Errorf("expected localhost default, got '%s'", server)
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestServerEnv(t *testing.T) {
}
return nil
}
h.List = func(server, view, page, state string, tags []string, size int32, all bool, w io.Writer) error {
h.List = func(server, view, page, state string, tags []string, namePrefix string, size int32, all bool, w io.Writer) error {
if server != "foobar" {
t.Error("expected foobar")
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestServerFlagOverride(t *testing.T) {
}
return nil
}
h.List = func(server, view, page, state string, tags []string, size int32, all bool, w io.Writer) error {
h.List = func(server, view, page, state string, tags []string, namePrefix string, size int32, all bool, w io.Writer) error {
if server != "flagval" {
t.Error("expected flagval")
}
Expand Down
1 change: 1 addition & 0 deletions tes/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (c *Client) ListTasks(ctx context.Context, req *ListTasksRequest) (*ListTas
u := c.address + "/v1/tasks?" + v.Encode()
fmt.Println("DEBUG u:", u)
hreq, _ := http.NewRequest("GET", u, nil)
hreq.SetBasicAuth(c.User, c.Password)
fmt.Println("DEBUG hreq:", hreq)
// hreq.WithContext(ctx)
// hreq.SetBasicAuth(c.User, c.Password)
Expand Down
2 changes: 1 addition & 1 deletion tes/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestBase64Encode(t *testing.T) {
},
}

expected := "ewogICJpZCI6ICJ0YXNrMSIsCiAgImV4ZWN1dG9ycyI6IFsKICAgIHsKICAgICAgImltYWdlIjogImFscGluZSIsCiAgICAgICJjb21tYW5kIjogWwogICAgICAgICJlY2hvIiwKICAgICAgICAiaGVsbG8gd29ybGQiCiAgICAgIF0KICAgIH0KICBdCn0="
expected := "ewogICJleGVjdXRvcnMiOiAgWwogICAgewogICAgICAiY29tbWFuZCI6ICBbCiAgICAgICAgImVjaG8iLAogICAgICAgICJoZWxsbyB3b3JsZCIKICAgICAgXSwKICAgICAgImltYWdlIjogICJhbHBpbmUiCiAgICB9CiAgXSwKICAiaWQiOiAgInRhc2sxIgp9"

encoded, err := Base64Encode(task)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions tests/funnel_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

dockerTypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
dockerFilters "github.com/docker/docker/api/types/filters"
docker "github.com/docker/docker/client"
runlib "github.com/ohsu-comp-bio/funnel/cmd/run"
Expand Down Expand Up @@ -424,9 +425,8 @@ func (f *Funnel) findTestServerContainers() []string {
}

func (f *Funnel) killTestServerContainers(ids []string) {
timeout := 10 * time.Second
for _, n := range ids {
err := f.Docker.ContainerStop(context.Background(), strings.TrimPrefix(n, "/"), &timeout)
err := f.Docker.ContainerStop(context.Background(), strings.TrimPrefix(n, "/"), container.StopOptions{})
if err != nil {
panic(err)
}
Expand Down

0 comments on commit ce4271c

Please sign in to comment.