GoogleCloudPlatform / traffic-director-grpc-bootstrap

Apache License 2.0
20 stars 18 forks source link

Add unit test to test default behavior #43

Closed arvindbr8 closed 1 year ago

arvindbr8 commented 1 year ago

Flags are knobs that control the output generated by this generator. The flags also have a default value. Currently we (try to) have unit tests around each scenario the bootstrap generator could be likely used for. However we do not have a test case around what the config that is outputted when there are no flag values being passed.

I tried to see if there was a clean way of testing main(), however since the output is either written to stdout or to a file and since there are APIs calls being made (like for eg to the metadata server), This approach uses flag.Parse() to get the args into variables. However with this approach we are forcing a mechanism to update this test whenever there is an update the flags.

arvindbr8 commented 1 year ago

Let me take another stab at this. Closing this one for now.