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

Function TestConfigSetValues

cmd/ddev/cmd/config_test.go:129–377  ·  view source on GitHub ↗

TestConfigSetValues sets all available configuration values using command flags, then confirms that the values have been correctly written to the config file.

(t *testing.T)

Source from the content-addressed store, hash-verified

127// TestConfigSetValues sets all available configuration values using command flags, then confirms that the
128// values have been correctly written to the config file.
129func TestConfigSetValues(t *testing.T) {
130 assert := asrt.New(t)
131
132 projectName := strings.ToLower(t.Name())
133 origDir, _ := os.Getwd()
134 _, _ = exec.RunHostCommand(DdevBin, "stop", "--unlist", projectName)
135
136 // Create a temporary directory and switch to it.
137 tmpDir := testcommon.CreateTmpDir(t.Name())
138 _ = os.Chdir(tmpDir)
139
140 var err error
141
142 t.Cleanup(func() {
143 err = os.Chdir(origDir)
144 assert.NoError(err)
145 out, err := exec.RunHostCommand(DdevBin, "delete", "-Oy", projectName)
146 assert.NoError(err, "output=%s", out)
147 _ = os.RemoveAll(tmpDir)
148 })
149
150 _ = os.Chdir(tmpDir)
151
152 // Build config args
153 docroot := "web"
154 projectType := nodeps.AppTypePHP
155 phpVersion := nodeps.PHP81
156 routerHTTPPort := "81"
157 routerHTTPSPort := "444"
158 hostDBPort := "60001"
159 hostWebserverPort := "60002"
160 hostHTTPSPort := "60003"
161 xdebugEnabled := true
162 noProjectMount := true
163 composerRoot := "composer-root"
164 composerVersion := "2.0.0-RC2"
165 additionalHostnamesSlice := []string{"abc", "123", "xyz"}
166 additionalHostnames := strings.Join(additionalHostnamesSlice, ",")
167 additionalFQDNsSlice := []string{"abc.com", "123.pizza", "xyz.co.uk"}
168 additionalFQDNs := strings.Join(additionalFQDNsSlice, ",")
169 omitContainersSlice := []string{"ddev-ssh-agent"}
170 omitContainers := strings.Join(omitContainersSlice, ",")
171 webimageExtraPackagesSlice := []string{"php-bcmath", "php7.3-tidy"}
172 webimageExtraPackages := strings.Join(webimageExtraPackagesSlice, ",")
173 dbimageExtraPackagesSlice := []string{"netcat", "ncdu"}
174 dbimageExtraPackages := strings.Join(dbimageExtraPackagesSlice, ",")
175
176 uploadDirsSlice := []string{"custom", "config", "path"}
177 webserverType := nodeps.WebserverApacheFPM
178 webImage := "custom-web-image"
179 webWorkingDir := "/custom/web/dir"
180 dbWorkingDir := "/custom/db/dir"
181 mailpitHTTPPort := "5001"
182 projectTLD := "nowhere.example.com"
183 useDNSWhenPossible := false
184 timezone := "America/Chicago"
185 webEnv := "SOMEENV=some+val"
186 nodejsVersion := "16"

Callers

nothing calls this directly

Calls 7

GetUploadDirsMethod · 0.95
GetMailpitHTTPPortMethod · 0.95
RunHostCommandFunction · 0.92
CreateTmpDirFunction · 0.92
ChdirMethod · 0.80
CleanupMethod · 0.80
UnmarshalMethod · 0.65

Tested by

no test coverage detected