MCPcopy Index your code
hub / github.com/ddev/ddev / ClearDockerEnv

Function ClearDockerEnv

pkg/testcommon/testcommon.go:337–369  ·  view source on GitHub ↗

ClearDockerEnv unsets env vars set in platform DockerEnv() so that they can be set by another test run.

()

Source from the content-addressed store, hash-verified

335// ClearDockerEnv unsets env vars set in platform DockerEnv() so that
336// they can be set by another test run.
337func 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
372func ContainerCheck(checkName string, checkState string) (bool, error) {

Callers 15

TestPHPOverridesFunction · 0.92
TestPHPConfigFunction · 0.92
setupPlatformProjectFunction · 0.92
TestProcessHooksFunction · 0.92
TestMainFunction · 0.92
TestDdevXdebugEnabledFunction · 0.92
TestDdevMysqlWorksFunction · 0.92
TestGetAppsFunction · 0.92
TestDdevImportDBFunction · 0.92
TestDdevAllDatabasesFunction · 0.92

Calls 1

WarnfMethod · 0.80

Tested by 15

TestPHPOverridesFunction · 0.74
TestPHPConfigFunction · 0.74
setupPlatformProjectFunction · 0.74
TestProcessHooksFunction · 0.74
TestMainFunction · 0.74
TestDdevXdebugEnabledFunction · 0.74
TestDdevMysqlWorksFunction · 0.74
TestGetAppsFunction · 0.74
TestDdevImportDBFunction · 0.74
TestDdevAllDatabasesFunction · 0.74