use of com.yahoo.athenz.zts.store.CloudStore in project athenz by yahoo.
the class CloudStoreTest method testLoadBootMetaDataInvalidDocumentGet.
@Test
public void testLoadBootMetaDataInvalidDocumentGet() throws InterruptedException, ExecutionException, TimeoutException {
CloudStore store = new CloudStore(null);
HttpClient httpClient = Mockito.mock(HttpClient.class);
ContentResponse response = Mockito.mock(ContentResponse.class);
Mockito.when(response.getStatus()).thenReturn(404);
store.setHttpClient(httpClient);
Mockito.when(httpClient.GET("http://169.254.169.254/latest/dynamic/instance-identity/document")).thenReturn(response);
assertFalse(store.loadBootMetaData());
store.close();
}
use of com.yahoo.athenz.zts.store.CloudStore in project athenz by yahoo.
the class CloudStoreTest method testAssumeAWSRoleAWSNotEnabled.
@Test
public void testAssumeAWSRoleAWSNotEnabled() {
CloudStore cloudStore = new CloudStore(null);
try {
cloudStore.assumeAWSRole("account", "sycner", "athenz.syncer");
fail();
} catch (ResourceException ex) {
assertEquals(ex.getCode(), 500);
}
cloudStore.close();
}
use of com.yahoo.athenz.zts.store.CloudStore in project athenz by yahoo.
the class CloudStoreTest method testFetchRoleCredentialsNoRole.
@Test
public void testFetchRoleCredentialsNoRole() {
CloudStore store = new CloudStore(null);
store.awsRole = null;
assertFalse(store.fetchRoleCredentials());
store.awsRole = "";
assertFalse(store.fetchRoleCredentials());
store.close();
}
use of com.yahoo.athenz.zts.store.CloudStore in project athenz by yahoo.
the class CloudStoreTest method testUpdateAccountUpdate.
@Test
public void testUpdateAccountUpdate() {
CloudStore store = new CloudStore(null);
assertNull(store.getCloudAccount("iaas"));
// set the account to 1234
store.updateAccount("iaas", "1234");
assertEquals("1234", store.getCloudAccount("iaas"));
// update the account value
store.updateAccount("iaas", "1235");
assertEquals("1235", store.getCloudAccount("iaas"));
store.close();
}
use of com.yahoo.athenz.zts.store.CloudStore in project athenz by yahoo.
the class CloudStoreTest method testParseInstanceInfo.
@Test
public void testParseInstanceInfo() {
CloudStore store = new CloudStore(null);
assertTrue(store.parseInstanceInfo(AWS_INSTANCE_DOCUMENT));
assertEquals(store.awsRegion, "us-west-2");
store.close();
}
Aggregations