Tests should never directly add to the global command line, because some users of the tests might not want them there. For example, options might only get set directly from a config file. To achieve that, e2e/framework/config, e2e/framework/viperconfig, and e2e/framework/test_context.go avoid using the global flag set and instead expect to be told by the caller which flag set to use. Tests that called flag directly either get updated or obsolete flags get removed. The exception is framework.HandleFlags, which as before directly implements global command line handling. This is a breaking change for test suites which do not use that function (and only those): they now need to ensure that they copy individual flags from tests. Because the RegisterCommonFlags prototype has changed, test suite authors will notice due to the resulting compilation errors.
5.6 KiB
5.6 KiB