ClearDockerEnv unsets env vars set in platform DockerEnv() so that they can be set by another test run.
()
| 335 | // ClearDockerEnv unsets env vars set in platform DockerEnv() so that |
| 336 | // they can be set by another test run. |
| 337 | func ClearDockerEnv() { |
| 338 | envVars := []string{ |
| 339 | "COMPOSE_PROJECT_NAME", |
| 340 | "DDEV_SITENAME", |
| 341 | "DDEV_DBIMAGE", |
| 342 | "DDEV_WEBIMAGE", |
| 343 | "DDEV_APPROOT", |
| 344 | "DDEV_HOST_WEBSERVER_PORT", |
| 345 | "DDEV_HOST_HTTPS_PORT", |
| 346 | "DDEV_DOCROOT", |
| 347 | "DDEV_HOSTNAME", |
| 348 | "DDEV_DB_CONTAINER_COMMAND", |
| 349 | "DDEV_PHP_VERSION", |
| 350 | "DDEV_WEBSERVER_TYPE", |
| 351 | "DDEV_PROJECT_TYPE", |
| 352 | "DDEV_ROUTER_HTTP_PORT", |
| 353 | "DDEV_ROUTER_HTTPS_PORT", |
| 354 | "DDEV_HOST_DB_PORT", |
| 355 | "DDEV_HOST_WEBSERVER_PORT", |
| 356 | "DDEV_MAILPIT_PORT", |
| 357 | "DDEV_MAILPIT_HTTPS_PORT", |
| 358 | "COLUMNS", |
| 359 | "LINES", |
| 360 | "DDEV_XDEBUG_ENABLED", |
| 361 | "IS_DDEV_PROJECT", |
| 362 | } |
| 363 | for _, env := range envVars { |
| 364 | err := os.Unsetenv(env) |
| 365 | if err != nil { |
| 366 | output.UserErr.Warnf("failed to unset %s: %v\n", env, err) |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | // ContainerCheck determines if a given container name exists and matches a given state |
| 372 | func ContainerCheck(checkName string, checkState string) (bool, error) { |