Beispiel #1
0
 public function testCacheWritten()
 {
     $ec2 = new Ec2MetadataGetter("/tmp");
     $ec2->allowDummy();
     $response = $ec2->getMultiple(['AmiId']);
     $this->assertEquals('ami-12345678', $response['AmiId']);
     $cacheContent = file_get_contents('/tmp/fd2f4b29d4b9a6c68c2669d66aacd03dffa6164b.json');
     $this->assertEquals('{"AmiId":"ami-12345678"}', $cacheContent);
 }
Beispiel #2
0
 public function testDummyMultiple()
 {
     $ec2 = new Ec2MetadataGetter("/tmp");
     $ec2->allowDummy();
     $data = $ec2->getMultiple(['Network', 'AmiId']);
     $interface = $data['Network']['11:22:33:44:55:66'];
     $this->assertEquals($interface['public-ipv4s'], '12.34.56.78');
     $this->assertEquals('ami-12345678', $data['AmiId']);
 }