From 54be3825529ba16f16b1828f01e1828ae8ce8a1e Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Mon, 20 May 2019 14:15:10 -0700 Subject: [PATCH] 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. --- test/images/agnhost/Dockerfile | 4 +++- test/images/agnhost/entrypoint-tester/ep.go | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/test/images/agnhost/Dockerfile b/test/images/agnhost/Dockerfile index 9b8766a9b54..be4c2e8e6f8 100644 --- a/test/images/agnhost/Dockerfile +++ b/test/images/agnhost/Dockerfile @@ -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"] diff --git a/test/images/agnhost/entrypoint-tester/ep.go b/test/images/agnhost/entrypoint-tester/ep.go index 2b9eb924181..7d9e177e964 100644 --- a/test/images/agnhost/entrypoint-tester/ep.go +++ b/test/images/agnhost/entrypoint-tester/ep.go @@ -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) }