tests: Clarifies agnhost's entrypoint-tester's usage

Some of the entrypoint-tester related tests overrides agnhost's default entrypoint
with agnhost-2, and this function's args will only contain the subcommand's
args (./agnhost entrypoint-tester these args), but we need to print *all* the
args, which is why os.Args should be printed instead.
This commit is contained in:
Claudiu Belu 2019-05-20 14:15:10 -07:00
parent af5c0c9e09
commit 54be382552
2 changed files with 8 additions and 2 deletions

View File

@ -40,7 +40,9 @@ ADD porter/localhost.key localhost.key
ADD agnhost agnhost
# needed for the entrypoint-tester related tests.
# needed for the entrypoint-tester related tests. Some of the entrypoint-tester related tests
# overrides this image's entrypoint with agnhost-2 binary, and will verify that the correct
# entrypoint is used by the containers.
RUN ln -s agnhost agnhost-2
ENTRYPOINT ["/agnhost"]

View File

@ -31,8 +31,12 @@ var CmdEntrypointTester = &cobra.Command{
Run: main,
}
// This program prints the arguments it's passed and exits.
// This program prints all the executable's arguments and exits.
func main(cmd *cobra.Command, args []string) {
// Some of the entrypoint-tester related tests overrides agnhost's default entrypoint
// with agnhost-2, and this function's args will only contain the subcommand's
// args (./agnhost entrypoint-tester these args), but we need to print *all* the
// args, which is why os.Args should be printed instead.
fmt.Printf("%v\n", os.Args)
os.Exit(0)
}