nacx requested changes on this pull request.
Thanks @code4clouds!
We're almost there. There are a couple annotations still to be removed and I've
tried to detail what tests should verify and how.
> +
+ /**
+ * The subnet of the Virtual Machine Scale Set Ip Configuration Properties
+ */
+ public abstract Subnet subnet();
+
+ /**
+ * The private IP address version of the Virtual Machine Scale Set Ip
Configuration Properties
+ */
+ @Nullable
+ public abstract String privateIPAddressVersion();
+
+ /**
+ * The load balancer backend address pools of the Virtual Machine Scale Set
Ip Configuration Properties
+ */
+ @Nullable
Still needs to be removed
> + /**
+ * The private IP address version of the Virtual Machine Scale Set Ip
Configuration Properties
+ */
+ @Nullable
+ public abstract String privateIPAddressVersion();
+
+ /**
+ * The load balancer backend address pools of the Virtual Machine Scale Set
Ip Configuration Properties
+ */
+ @Nullable
+ public abstract List<IdReference> loadBalancerBackendAddressPools();
+
+ /**
+ * The load balancer inbound nat pools of the Virtual Machine Scale Set Ip
Configuration Properties
+ */
+ @Nullable
Still needs to be removed
> + String subnetName = String.format("s-%s-%s",
> this.getClass().getSimpleName().toLowerCase(),
> System.getProperty("user.name"));
+ this.subnet = createDefaultSubnet(resourceGroupName, subnetName,
virtualNetworkName, "10.2.0.0/23");
+ assertNotNull(subnet);
+ assertNotNull(subnet.id());
+ this.subnetId = subnet.id();
+
+
+ vmssName = String.format("%3.24s", System.getProperty("user.name") +
RAND + this.getClass().getSimpleName()).toLowerCase().substring(0, 15);
+ }
+
+ @Test
+ public void testCreate() {
+ VirtualMachineScaleSet vmss = api().createOrUpdate(vmssName,
LOCATIONDESCRIPTION, getSKU(),
+ Collections.<String, String>emptyMap(), getProperties());
+ assertTrue(!vmss.name().isEmpty());
+ }
Add tests for the list, get and delete methods too, and provide an
`@AfterClass(alwaysRun = true)` method that deletes all the stuff created by
this test.
> + }
+
+ public void testVMSSCreate_PropertyUpgradePolicy() throws
InterruptedException {
+
server.enqueue(jsonResponse("/createvirtualmachinescalesetresponse.json").setResponseCode(200));
+ final VirtualMachineScaleSetApi vmssAPI =
api.getVirtualMachineScaleSetApi(resourcegroup);
+
assertEquals(vmssAPI.get("jclouds-vmssname").properties().upgradePolicy().mode(),
"Manual");
+ }
+
+ public void testVMSSCreate_NetworkProfile() throws InterruptedException {
+
server.enqueue(jsonResponse("/createvirtualmachinescalesetresponse.json").setResponseCode(200));
+ final VirtualMachineScaleSetApi vmssAPI =
api.getVirtualMachineScaleSetApi(resourcegroup);
+
assertEquals(vmssAPI.get("jclouds-vmssname").properties().virtualMachineProfile()
+ .networkProfile()
+ .networkInterfaceConfigurations()
+ .size(), 1);
+ }
These mock tests still don't meet their purpose:
* There should be only **one** test for each method in the API to verify that
the method generates the expected HTTP request. Verifying that means the test
method should:
- [x] Validate the returned object (this verifies serialization)
- [ ] Validate the generated requests using the `assertSent` method. This
validates that method invocation generated the expected HTTP request (expected
URI, headers, and body).
* If the API method defines a `@Fallback`, add another test for that method
that exercises it.
- [ ] For all methods with fallbacks, add a test that returns the response
code that triggers the fallback, and verify that the method returns the
expected result (usually `null`, empty lists, etc) instead of throwing an
exception.
In summary, this test class should just have the following test methods:
`testList`, `testListWhen404`, `testGet`, `testGetWhen404`,
`testCreateOrUpdate`, `testDelete` and `testDeleteWhen404`.
The
[AvailabilitySetApiMockTest](https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/AvailabilitySetApiMockTest.java)
is a good example to follow.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/412#pullrequestreview-73704791