@Test public void validate_environment_with_all_valid_variables_set_without_tls() { Map<String, String> variables = ImmutableMap.<String, String>builder() .put(DOCKER_HOST, "tcp://192.168.99.100:2376") .put("SOME_VARIABLE", "SOME_VALUE") .build(); RemoteEnvironmentValidator.instance().validateEnvironmentVariables(variables); }
@Test public void validate_environment_with_all_valid_variables_set_with_tls() { Map<String, String> variables = ImmutableMap.<String, String>builder() .put(DOCKER_HOST, "tcp://192.168.99.100:2376") .put(DOCKER_TLS_VERIFY, "1") .put(DOCKER_CERT_PATH, "/path/to/certs") .put("SOME_VARIABLE", "SOME_VALUE") .build(); RemoteEnvironmentValidator.instance().validateEnvironmentVariables(variables); } }
@Test public void throw_exception_if_docker_cert_path_is_missing_and_tls_is_on() { Map<String, String> variables = ImmutableMap.<String, String>builder() .put(DOCKER_HOST, "tcp://192.168.99.100:2376") .put(DOCKER_TLS_VERIFY, "1") .build(); exception.expect(IllegalStateException.class); exception.expectMessage("Missing required environment variables: "); exception.expectMessage(DOCKER_CERT_PATH); RemoteEnvironmentValidator.instance().validateEnvironmentVariables(variables); }
@Test public void throw_exception_if_docker_host_is_not_set() { Map<String, String> variables = ImmutableMap.<String, String>builder() .put("SOME_VARIABLE", "SOME_VALUE") .build(); exception.expect(IllegalStateException.class); exception.expectMessage("Missing required environment variables: "); exception.expectMessage(DOCKER_HOST); RemoteEnvironmentValidator.instance().validateEnvironmentVariables(variables); }