packagemainimport("context""fmt""net/http""testing""github.com/testcontainers/testcontainers-go""github.com/testcontainers/testcontainers-go/wait")typenginxContainerstruct{testcontainers.ContainerURIstring}funcsetupNginx(ctxcontext.Context)(*nginxContainer,error){req:=testcontainers.ContainerRequest{Image:"nginx",ExposedPorts:[]string{"80/tcp"},WaitingFor:wait.ForHTTP("/"),}container,err:=testcontainers.GenericContainer(ctx,testcontainers.GenericContainerRequest{ContainerRequest:req,Started:true,})iferr!=nil{returnnil,err}ip,err:=container.Host(ctx)iferr!=nil{returnnil,err}mappedPort,err:=container.MappedPort(ctx,"80")iferr!=nil{returnnil,err}uri:=fmt.Sprintf("http://%s:%s",ip,mappedPort.Port())return&nginxContainer{Container:container,URI:uri},nil}funcTestIntegrationNginxLatestReturn(t*testing.T){iftesting.Short(){t.Skip("skipping integration test")}ctx:=context.Background()nginxC,err:=setupNginx(ctx)iferr!=nil{t.Fatal(err)}// Clean up the container after the test is completedefernginxC.Terminate(ctx)resp,err:=http.Get(nginxC.URI)ifresp.StatusCode!=http.StatusOK{t.Fatalf("Expected status code %d. Got %d.",http.StatusOK,resp.StatusCode)}}