package main import "testing" func TestCommandForInvocationKeepsV13ComposeAgentCompatible(t *testing.T) { t.Parallel() tests := []struct { arguments []string want string }{ {arguments: []string{"/usr/local/bin/domain-control"}, want: "serve"}, {arguments: []string{"/usr/local/bin/domain-control", "update-agent"}, want: "update-agent"}, {arguments: []string{"/usr/local/bin/domain-control", "healthcheck"}, want: "healthcheck"}, {arguments: []string{"/usr/local/bin/update-agent"}, want: "update-agent"}, {arguments: []string{"/usr/local/bin/update-agent", "serve"}, want: "update-agent"}, {arguments: []string{"/usr/local/bin/domain-control", "serve", "extra"}, want: "invalid"}, {arguments: nil, want: "invalid"}, } for _, test := range tests { if got := commandForInvocation(test.arguments); got != test.want { t.Errorf("commandForInvocation(%q) = %q; want %q", test.arguments, got, test.want) } } }