|  | @@ -514,43 +514,11 @@ func overwriteFileStorageAccount(t *testing.T, absComposefileName string, storag
 | 
											
												
													
														|  |  	assert.NilError(t, err)
 |  |  	assert.NilError(t, err)
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -func TestUpResources(t *testing.T) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +func TestUpSecretsResources(t *testing.T) {
 | 
											
												
													
														|  |  	const (
 |  |  	const (
 | 
											
												
													
														|  | -		composeProjectName = "testresources"
 |  | 
 | 
											
												
													
														|  | -		serverContainer    = composeProjectName + "_web"
 |  | 
 | 
											
												
													
														|  | -		wordsContainer     = composeProjectName + "_words"
 |  | 
 | 
											
												
													
														|  | -	)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	c := NewParallelE2eCLI(t, binDir)
 |  | 
 | 
											
												
													
														|  | -	setupTestResourceGroup(t, c)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	t.Run("compose up", func(t *testing.T) {
 |  | 
 | 
											
												
													
														|  | -		c.RunDockerCmd("compose", "up", "-f", "../composefiles/aci-demo/aci_demo_port_resources.yaml", "--project-name", composeProjectName)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -		res := c.RunDockerCmd("inspect", serverContainer)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -		webInspect, err := ParseContainerInspect(res.Stdout())
 |  | 
 | 
											
												
													
														|  | -		assert.NilError(t, err)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, webInspect.HostConfig.CPULimit, 0.7)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, webInspect.HostConfig.MemoryLimit, uint64(1073741824))
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, webInspect.HostConfig.CPUReservation, 0.5)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, webInspect.HostConfig.MemoryReservation, uint64(536870912))
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -		res = c.RunDockerCmd("inspect", wordsContainer)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -		wordsInspect, err := ParseContainerInspect(res.Stdout())
 |  | 
 | 
											
												
													
														|  | -		assert.NilError(t, err)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, wordsInspect.HostConfig.CPULimit, 0.5)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, wordsInspect.HostConfig.MemoryLimit, uint64(751619276))
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, wordsInspect.HostConfig.CPUReservation, 0.5)
 |  | 
 | 
											
												
													
														|  | -		assert.Equal(t, wordsInspect.HostConfig.MemoryReservation, uint64(751619276))
 |  | 
 | 
											
												
													
														|  | -	})
 |  | 
 | 
											
												
													
														|  | -}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -func TestUpSecrets(t *testing.T) {
 |  | 
 | 
											
												
													
														|  | -	const (
 |  | 
 | 
											
												
													
														|  | -		composeProjectName = "aci_secrets"
 |  | 
 | 
											
												
													
														|  | 
 |  | +		composeProjectName = "aci_test"
 | 
											
												
													
														|  |  		serverContainer    = composeProjectName + "_web"
 |  |  		serverContainer    = composeProjectName + "_web"
 | 
											
												
													
														|  | 
 |  | +		secondContainer    = composeProjectName + "_web2"
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		secret1Name  = "mytarget1"
 |  |  		secret1Name  = "mytarget1"
 | 
											
												
													
														|  |  		secret1Value = "myPassword1\n"
 |  |  		secret1Value = "myPassword1\n"
 | 
											
										
											
												
													
														|  | @@ -559,7 +527,7 @@ func TestUpSecrets(t *testing.T) {
 | 
											
												
													
														|  |  		secret2Value = "another_password\n"
 |  |  		secret2Value = "another_password\n"
 | 
											
												
													
														|  |  	)
 |  |  	)
 | 
											
												
													
														|  |  	var (
 |  |  	var (
 | 
											
												
													
														|  | -		basefilePath    = filepath.Join("..", "composefiles", composeProjectName)
 |  | 
 | 
											
												
													
														|  | 
 |  | +		basefilePath    = filepath.Join("..", "composefiles", "aci_secrets_resources")
 | 
											
												
													
														|  |  		composefilePath = filepath.Join(basefilePath, "compose.yml")
 |  |  		composefilePath = filepath.Join(basefilePath, "compose.yml")
 | 
											
												
													
														|  |  	)
 |  |  	)
 | 
											
												
													
														|  |  	c := NewParallelE2eCLI(t, binDir)
 |  |  	c := NewParallelE2eCLI(t, binDir)
 | 
											
										
											
												
													
														|  | @@ -570,7 +538,7 @@ func TestUpSecrets(t *testing.T) {
 | 
											
												
													
														|  |  		res := c.RunDockerCmd("ps")
 |  |  		res := c.RunDockerCmd("ps")
 | 
											
												
													
														|  |  		out := lines(res.Stdout())
 |  |  		out := lines(res.Stdout())
 | 
											
												
													
														|  |  		// Check one container running
 |  |  		// Check one container running
 | 
											
												
													
														|  | -		assert.Assert(t, is.Len(out, 2))
 |  | 
 | 
											
												
													
														|  | 
 |  | +		assert.Assert(t, is.Len(out, 3))
 | 
											
												
													
														|  |  		webRunning := false
 |  |  		webRunning := false
 | 
											
												
													
														|  |  		for _, l := range out {
 |  |  		for _, l := range out {
 | 
											
												
													
														|  |  			if strings.Contains(l, serverContainer) {
 |  |  			if strings.Contains(l, serverContainer) {
 | 
											
										
											
												
													
														|  | @@ -579,13 +547,22 @@ func TestUpSecrets(t *testing.T) {
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  		assert.Assert(t, webRunning, "web container not running ; ps:\n"+res.Stdout())
 |  |  		assert.Assert(t, webRunning, "web container not running ; ps:\n"+res.Stdout())
 | 
											
												
													
														|  | 
 |  | +	})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -		res = c.RunDockerCmd("inspect", serverContainer)
 |  | 
 | 
											
												
													
														|  | 
 |  | +	t.Cleanup(func() {
 | 
											
												
													
														|  | 
 |  | +		c.RunDockerCmd("compose", "down", "--project-name", composeProjectName)
 | 
											
												
													
														|  | 
 |  | +		res := c.RunDockerCmd("ps")
 | 
											
												
													
														|  | 
 |  | +		out := lines(res.Stdout())
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, len(out), 1)
 | 
											
												
													
														|  | 
 |  | +	})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -		containerInspect, err := ParseContainerInspect(res.Stdout())
 |  | 
 | 
											
												
													
														|  | -		assert.NilError(t, err)
 |  | 
 | 
											
												
													
														|  | -		assert.Assert(t, is.Len(containerInspect.Ports, 1))
 |  | 
 | 
											
												
													
														|  | -		endpoint := fmt.Sprintf("http://%s:%d", containerInspect.Ports[0].HostIP, containerInspect.Ports[0].HostPort)
 |  | 
 | 
											
												
													
														|  | 
 |  | +	res := c.RunDockerCmd("inspect", serverContainer)
 | 
											
												
													
														|  | 
 |  | +	webInspect, err := ParseContainerInspect(res.Stdout())
 | 
											
												
													
														|  | 
 |  | +	assert.NilError(t, err)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	t.Run("read secrets", func(t *testing.T) {
 | 
											
												
													
														|  | 
 |  | +		assert.Assert(t, is.Len(webInspect.Ports, 1))
 | 
											
												
													
														|  | 
 |  | +		endpoint := fmt.Sprintf("http://%s:%d", webInspect.Ports[0].HostIP, webInspect.Ports[0].HostPort)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  		output := HTTPGetWithRetry(t, endpoint+"/"+secret1Name, http.StatusOK, 2*time.Second, 20*time.Second)
 |  |  		output := HTTPGetWithRetry(t, endpoint+"/"+secret1Name, http.StatusOK, 2*time.Second, 20*time.Second)
 | 
											
												
													
														|  |  		// replace windows carriage return
 |  |  		// replace windows carriage return
 | 
											
										
											
												
													
														|  | @@ -595,13 +572,22 @@ func TestUpSecrets(t *testing.T) {
 | 
											
												
													
														|  |  		output = HTTPGetWithRetry(t, endpoint+"/"+secret2Name, http.StatusOK, 2*time.Second, 20*time.Second)
 |  |  		output = HTTPGetWithRetry(t, endpoint+"/"+secret2Name, http.StatusOK, 2*time.Second, 20*time.Second)
 | 
											
												
													
														|  |  		output = strings.ReplaceAll(output, "\r", "")
 |  |  		output = strings.ReplaceAll(output, "\r", "")
 | 
											
												
													
														|  |  		assert.Equal(t, output, secret2Value)
 |  |  		assert.Equal(t, output, secret2Value)
 | 
											
												
													
														|  | 
 |  | +	})
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -		t.Cleanup(func() {
 |  | 
 | 
											
												
													
														|  | -			c.RunDockerCmd("compose", "down", "--project-name", composeProjectName)
 |  | 
 | 
											
												
													
														|  | -			res := c.RunDockerCmd("ps")
 |  | 
 | 
											
												
													
														|  | -			out := lines(res.Stdout())
 |  | 
 | 
											
												
													
														|  | -			assert.Equal(t, len(out), 1)
 |  | 
 | 
											
												
													
														|  | -		})
 |  | 
 | 
											
												
													
														|  | 
 |  | +	t.Run("check resource limits", func(t *testing.T) {
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, webInspect.HostConfig.CPULimit, 0.7)
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, webInspect.HostConfig.MemoryLimit, uint64(1073741824))
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, webInspect.HostConfig.CPUReservation, 0.5)
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, webInspect.HostConfig.MemoryReservation, uint64(536870912))
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		res = c.RunDockerCmd("inspect", secondContainer)
 | 
											
												
													
														|  | 
 |  | +		web2Inspect, err := ParseContainerInspect(res.Stdout())
 | 
											
												
													
														|  | 
 |  | +		assert.NilError(t, err)
 | 
											
												
													
														|  | 
 |  | +		assert.NilError(t, err)
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, web2Inspect.HostConfig.CPULimit, 0.5)
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, web2Inspect.HostConfig.MemoryLimit, uint64(751619276))
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, web2Inspect.HostConfig.CPUReservation, 0.5)
 | 
											
												
													
														|  | 
 |  | +		assert.Equal(t, web2Inspect.HostConfig.MemoryReservation, uint64(751619276))
 | 
											
												
													
														|  |  	})
 |  |  	})
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 |