mirror of
				https://github.com/docker/compose.git
				synced 2025-10-31 11:14:02 +01:00 
			
		
		
		
	Add profile e2e test case to document in compose
Signed-off-by: Joana Hrotko <joana.hrotko@docker.com>
This commit is contained in:
		
							parent
							
								
									501b5acde6
								
							
						
					
					
						commit
						eececb9add
					
				
							
								
								
									
										15
									
								
								pkg/e2e/fixtures/profiles/docker-compose.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								pkg/e2e/fixtures/profiles/docker-compose.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | services: | ||||||
|  |   foo: | ||||||
|  |     container_name: foo_c | ||||||
|  |     profiles: [ test ] | ||||||
|  |     image: alpine | ||||||
|  |     depends_on: [ db ] | ||||||
|  | 
 | ||||||
|  |   bar: | ||||||
|  |     container_name: bar_c | ||||||
|  |     profiles: [ test ] | ||||||
|  |     image: alpine | ||||||
|  |    | ||||||
|  |   db: | ||||||
|  |     container_name: db_c | ||||||
|  |     image: alpine | ||||||
| @ -179,3 +179,16 @@ func TestUpWithAllResources(t *testing.T) { | |||||||
| 	assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol"  Created`, projectName)), res.Combined()) | 	assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Volume "%s_my_vol"  Created`, projectName)), res.Combined()) | ||||||
| 	assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net  Created`, projectName)), res.Combined()) | 	assert.Assert(t, strings.Contains(res.Combined(), fmt.Sprintf(`Network %s_my_net  Created`, projectName)), res.Combined()) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func TestUpProfile(t *testing.T) { | ||||||
|  | 	c := NewCLI(t) | ||||||
|  | 	const projectName = "compose-e2e-up-profile" | ||||||
|  | 	t.Cleanup(func() { | ||||||
|  | 		c.RunDockerComposeCmd(t, "--project-name", projectName, "--profile", "test", "down", "-v") | ||||||
|  | 	}) | ||||||
|  | 
 | ||||||
|  | 	res := c.RunDockerComposeCmd(t, "-f", "./fixtures/profiles/docker-compose.yaml", "--project-name", projectName, "up", "foo") | ||||||
|  | 	assert.Assert(t, strings.Contains(res.Combined(), `Container db_c  Created`), res.Combined()) | ||||||
|  | 	assert.Assert(t, strings.Contains(res.Combined(), `Container foo_c  Created`), res.Combined()) | ||||||
|  | 	assert.Assert(t, !strings.Contains(res.Combined(), `Container bar_c  Created`), res.Combined()) | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user