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

Function TestGetWebContainerDirectURLsErrorHandling

pkg/ddevapp/ddevapp_test.go:3816–3835  ·  view source on GitHub ↗

TestGetWebContainerDirectURLsErrorHandling tests error handling in GetWebContainerDirectHTTPURL and GetWebContainerDirectHTTPSURL

(t *testing.T)

Source from the content-addressed store, hash-verified

3814
3815// TestGetWebContainerDirectURLsErrorHandling tests error handling in GetWebContainerDirectHTTPURL and GetWebContainerDirectHTTPSURL
3816func TestGetWebContainerDirectURLsErrorHandling(t *testing.T) {
3817 assert := asrt.New(t)
3818
3819 // Create a temporary directory for a new app
3820 testDir := testcommon.CreateTmpDir(t.Name())
3821 defer testcommon.CleanupDir(testDir)
3822 defer testcommon.Chdir(testDir)()
3823
3824 // Create a new app that hasn't been started yet
3825 app, err := ddevapp.NewApp(testDir, true)
3826 require.NoError(t, err)
3827
3828 // Verify that GetWebContainerDirectHTTPURL returns an empty string when container doesn't exist
3829 httpURL := app.GetWebContainerDirectHTTPURL()
3830 assert.Empty(httpURL, "GetWebContainerDirectHTTPURL should return an empty string when container doesn't exist")
3831
3832 // Verify that GetWebContainerDirectHTTPSURL returns an empty string when container doesn't exist
3833 httpsURL := app.GetWebContainerDirectHTTPSURL()
3834 assert.Empty(httpsURL, "GetWebContainerDirectHTTPSURL should return an empty string when container doesn't exist")
3835}
3836
3837// TestGetWebContainerDirectURLsWithGenericWebserver tests the behavior of GetWebContainerDirectHTTPURL and GetWebContainerDirectHTTPSURL
3838// with a generic webserver type and web_extra_exposed_ports

Callers

nothing calls this directly

Calls 6

CreateTmpDirFunction · 0.92
CleanupDirFunction · 0.92
ChdirFunction · 0.92
NewAppFunction · 0.92

Tested by

no test coverage detected