mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Merge pull request #12939 from draghuram/history_test
Adding test for "GET /images/(name)/history" API.
This commit is contained in:
		
						commit
						24bd3db0b5
					
				
					 1 changed files with 22 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -125,3 +125,25 @@ func (s *DockerSuite) TestApiImagesDelete(c *check.C) {
 | 
			
		|||
	c.Assert(status, check.Equals, http.StatusOK)
 | 
			
		||||
	c.Assert(err, check.IsNil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *DockerSuite) TestApiImagesHistory(c *check.C) {
 | 
			
		||||
	testRequires(c, Network)
 | 
			
		||||
	name := "test-api-images-history"
 | 
			
		||||
	out, err := buildImage(name, "FROM hello-world\nENV FOO bar", false)
 | 
			
		||||
	c.Assert(err, check.IsNil)
 | 
			
		||||
 | 
			
		||||
	defer deleteImages(name)
 | 
			
		||||
	id := strings.TrimSpace(out)
 | 
			
		||||
 | 
			
		||||
	status, body, err := sockRequest("GET", "/images/"+id+"/history", nil)
 | 
			
		||||
	c.Assert(err, check.IsNil)
 | 
			
		||||
	c.Assert(status, check.Equals, http.StatusOK)
 | 
			
		||||
 | 
			
		||||
	var historydata []types.ImageHistory
 | 
			
		||||
	if err = json.Unmarshal(body, &historydata); err != nil {
 | 
			
		||||
		c.Fatalf("Error on unmarshal: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	c.Assert(len(historydata), check.Not(check.Equals), 0)
 | 
			
		||||
	c.Assert(historydata[0].Tags[0], check.Equals, "test-api-images-history:latest")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue