Describe("FetchMetadata", func() { Context("when fetching metadata from the docker hub registry", func() { It("returns the ImageMetadata with the WorkingDir, StartCommand, and PortConfig, and sets the monitored port to the lowest exposed tcp port", func() { fakeDockerSessionFactory.MakeSessionReturns(fakeDockerSession, nil) imageList := map[string]*registry.ImgData{ "29d531509fb": ®istry.ImgData{ ID: "29d531509fb", Checksum: "dsflksdfjlkj", ChecksumPayload: "sdflksdjfkl", Tag: "latest", }, } fakeDockerSession.GetRepositoryDataReturns( ®istry.RepositoryData{ ImgList: imageList, Endpoints: []string{"https://registry-1.docker.io/v1/"}, Tokens: []string{"signature=abc,repository=\"cloudfoundry/lattice-app\",access=read"}, }, nil) fakeDockerSession.GetRemoteTagsReturns(map[string]string{"latest": "29d531509fb"}, nil) fakeDockerSession.GetRemoteImageJSONReturns( []byte(`{ "container_config":{ "ExposedPorts":{"28321/tcp":{}, "6923/udp":{}, "27017/tcp":{}} }, "config":{ "WorkingDir":"/home/app", "User":"******", "Entrypoint":["/lattice-app"], "Cmd":["--enableAwesomeMode=true","iloveargs"], "Env":["A=1","B=2"] } }`), 0,
Describe("FetchMetadata", func() { Context("when fetching metadata from the docker hub registry", func() { It("returns the ImageMetadata with the WorkingDir, StartCommand, and PortConfig, and sets the monitored port to the lowest exposed tcp port", func() { fakeDockerSessionFactory.MakeSessionReturns(fakeDockerSession, nil) imageList := map[string]*registry.ImgData{ "29d531509fb": ®istry.ImgData{ ID: "29d531509fb", Checksum: "dsflksdfjlkj", ChecksumPayload: "sdflksdjfkl", Tag: "latest", }, } fakeDockerSession.GetRepositoryDataReturns( ®istry.RepositoryData{ ImgList: imageList, Endpoints: []string{"https://registry-1.docker.io/v1/"}, }, nil) fakeDockerSession.GetRemoteTagsReturns(map[string]string{"latest": "29d531509fb"}, nil) fakeDockerSession.GetRemoteImageJSONReturns( []byte(`{ "container_config":{ "ExposedPorts":{"28321/tcp":{}, "6923/udp":{}, "27017/tcp":{}} }, "config":{ "WorkingDir":"/home/app", "User":"******", "Entrypoint":["/lattice-app"], "Cmd":["--enableAwesomeMode=true","iloveargs"], "Env":["A=1","B=2"] } }`), 0,