Skip to content

Commit 1c4a19c

Browse files
ericavellaErica Vellanoweth
andauthored
bug fixes (#653)
Co-authored-by: Erica Vellanoweth <evellanoweth@microsoft.com>
1 parent 3e96703 commit 1c4a19c

6 files changed

Lines changed: 83 additions & 184 deletions

File tree

src/VirtualClient/VirtualClient.Actions.FunctionalTests/SysbenchProfileTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ private IEnumerable<string> GetProfileExpectedCommands(bool singleVM, string dat
513513

514514
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --password [A-Za-z0-9+/=]+",
515515
$"python3 {this.mySQLPackagePath}/distribute-database.py --dbName sbtest --directories \"/mnt_vc_0;/mnt_vc_1;/mnt_vc_2;\"",
516-
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --password [A-Za-z0-9+/=]+",
516+
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 0 --password [A-Za-z0-9+/=]+",
517517

518-
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 127.0.0.1 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
518+
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 127.0.0.1 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
519519
};
520520
}
521521
}
@@ -545,7 +545,7 @@ private IEnumerable<string> GetProfileExpectedCommands(bool singleVM, string dat
545545
{
546546
"apt install python3 --yes --quiet",
547547
$"python3 {this.sysbenchPackagePath}/configure-workload-generator.py --distro Ubuntu --databaseSystem MySQL --packagePath {this.sysbenchPackagePath}",
548-
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
548+
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
549549
};
550550
}
551551
}
@@ -596,9 +596,9 @@ private IEnumerable<string> GetProfileExpectedCommands(bool singleVM, string dat
596596

597597
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --password [A-Za-z0-9+/=]+",
598598
$"python3 {this.postgreSQLPackagePath}/distribute-database.py --dbName sbtest --directories \"/mnt_vc_0;/mnt_vc_1;/mnt_vc_2;\" --password [A-Za-z0-9+/=]+",
599-
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --password [A-Za-z0-9+/=]+",
599+
$"python3 {this.sysbenchPackagePath}/populate-database.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 0 --password [A-Za-z0-9+/=]+",
600600

601-
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 127.0.0.1 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
601+
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 127.0.0.1 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
602602
};
603603
}
604604
}
@@ -628,7 +628,7 @@ private IEnumerable<string> GetProfileExpectedCommands(bool singleVM, string dat
628628
{
629629
"apt install python3 --yes --quiet",
630630
$"python3 {this.sysbenchPackagePath}/configure-workload-generator.py --distro Ubuntu --databaseSystem PostgreSQL --packagePath {this.sysbenchPackagePath}",
631-
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
631+
$"python3 {this.sysbenchPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 1800 --password [A-Za-z0-9+/=]+",
632632
};
633633
}
634634
}

src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchClientExecutorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public async Task SysbenchClientExecutorRunsTheExpectedTPCCWorkloadCommand()
266266
this.fixture.Parameters[nameof(SysbenchClientExecutor.Benchmark)] = "TPCC";
267267
this.fixture.Parameters[nameof(SysbenchClientExecutor.Workload)] = "tpcc";
268268

269-
string expectedCommand = $"python3 {this.mockPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 10 --password [A-Za-z0-9+/=]+";
269+
string expectedCommand = $"python3 {this.mockPackagePath}/run-workload.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 10 --password [A-Za-z0-9+/=]+";
270270
bool commandExecuted = false;
271271

272272
this.fixture.ProcessManager.OnCreateProcess = (exe, arguments, workingDir) =>
@@ -354,7 +354,7 @@ public async Task SysbenchClientExecutorRunsTheExpectedPostgreSQLTPCCWorkloadCom
354354
this.fixture.Parameters[nameof(SysbenchClientExecutor.Benchmark)] = "TPCC";
355355
this.fixture.Parameters[nameof(SysbenchClientExecutor.Workload)] = "tpcc";
356356

357-
string expectedCommand = $"python3 {this.mockPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 10 --password [A-Za-z0-9+/=]+";
357+
string expectedCommand = $"python3 {this.mockPackagePath}/run-workload.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 1 --workload tpcc --hostIpAddress 1.2.3.5 --durationSecs 10 --password [A-Za-z0-9+/=]+";
358358
bool commandExecuted = false;
359359

360360
this.fixture.ProcessManager.OnCreateProcess = (exe, arguments, workingDir) =>

src/VirtualClient/VirtualClient.Actions.UnitTests/Sysbench/SysbenchConfigurationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public async Task SysbenchConfigurationProperlyExecutesTPCCPreparation()
276276

277277
string[] expectedCommands =
278278
{
279-
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 100 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
279+
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 8 --tableCount 10 --warehouses 0 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
280280
};
281281

282282
int commandNumber = 0;
@@ -332,7 +332,7 @@ public async Task SysbenchConfigurationProperlyExecutesTPCCConfigurablePreparati
332332

333333
string[] expectedCommands =
334334
{
335-
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 16 --tableCount 40 --warehouses 1000 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
335+
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem MySQL --benchmark TPCC --threadCount 16 --tableCount 40 --warehouses 999 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
336336
};
337337

338338
int commandNumber = 0;
@@ -446,7 +446,7 @@ public async Task SysbenchConfigurationProperlyExecutesPostgreSQLTPCCConfigurabl
446446

447447
string[] expectedCommands =
448448
{
449-
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 16 --tableCount 40 --warehouses 1000 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
449+
$"python3 {this.mockPackagePath}/populate-database.py --dbName sbtest --databaseSystem PostgreSQL --benchmark TPCC --threadCount 16 --tableCount 40 --warehouses 999 --password [A-Za-z0-9+/=]+ --host \"1.2.3.5\""
450450
};
451451

452452
int commandNumber = 0;

src/VirtualClient/VirtualClient.Actions/Sysbench/SysbenchClientExecutor.cs

Lines changed: 18 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -179,69 +179,28 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
179179
{
180180
using (BackgroundOperations profiling = BackgroundOperations.BeginProfiling(this, cancellationToken))
181181
{
182-
switch (this.Benchmark)
183-
{
184-
case BenchmarkName.OLTP:
185-
await this.RunOLTPWorkloadAsync(telemetryContext, cancellationToken);
186-
break;
187-
case BenchmarkName.TPCC:
188-
await this.RunTPCCWorkloadAsync(telemetryContext, cancellationToken);
189-
break;
190-
default:
191-
throw new DependencyException(
192-
$"The '{this.Benchmark}' benchmark is not supported with the Sysbench workload. Supported options include: \"OLTP, TPCC\".",
193-
ErrorReason.NotSupported);
194-
}
195-
}
196-
});
197-
}
198-
199-
private async Task RunOLTPWorkloadAsync(EventContext telemetryContext, CancellationToken cancellationToken)
200-
{
201-
this.sysbenchLoggingArguments = this.BuildSysbenchLoggingArguments(prepare: false);
202-
this.sysbenchExecutionArguments = $"{this.sysbenchLoggingArguments} --workload {this.Workload} --hostIpAddress {this.ServerIpAddress} --durationSecs {this.Duration.TotalSeconds} --password {this.SuperUserPassword}";
203-
204-
string script = $"{this.SysbenchPackagePath}/run-workload.py ";
205-
206-
using (IProcessProxy process = await this.ExecuteCommandAsync(
207-
SysbenchExecutor.PythonCommand,
208-
script + this.sysbenchExecutionArguments,
209-
this.SysbenchPackagePath,
210-
telemetryContext,
211-
cancellationToken))
212-
{
213-
if (!cancellationToken.IsCancellationRequested)
214-
{
215-
await this.LogProcessDetailsAsync(process, telemetryContext, "Sysbench", logToFile: true);
216-
process.ThrowIfErrored<WorkloadException>(process.StandardError.ToString(), ErrorReason.WorkloadFailed);
217-
218-
this.CaptureMetrics(process, telemetryContext, cancellationToken);
219-
}
220-
}
221-
}
222-
223-
private async Task RunTPCCWorkloadAsync(EventContext telemetryContext, CancellationToken cancellationToken)
224-
{
225-
this.sysbenchLoggingArguments = this.BuildSysbenchLoggingArguments(prepare: false);
226-
this.sysbenchExecutionArguments = $"{this.sysbenchLoggingArguments} --workload {this.Workload} --hostIpAddress {this.ServerIpAddress} --durationSecs {this.Duration.TotalSeconds} --password {this.SuperUserPassword}";
182+
this.sysbenchLoggingArguments = this.BuildSysbenchLoggingArguments(SysbenchMode.Run);
183+
this.sysbenchExecutionArguments = $"{this.sysbenchLoggingArguments} --workload {this.Workload} --hostIpAddress {this.ServerIpAddress} --durationSecs {this.Duration.TotalSeconds} --password {this.SuperUserPassword}";
227184

228-
string script = $"{this.SysbenchPackagePath}/run-workload.py ";
185+
string script = $"{this.SysbenchPackagePath}/run-workload.py ";
229186

230-
using (IProcessProxy process = await this.ExecuteCommandAsync(
231-
SysbenchExecutor.PythonCommand,
232-
script + this.sysbenchExecutionArguments,
233-
this.SysbenchPackagePath,
234-
telemetryContext,
235-
cancellationToken))
236-
{
237-
if (!cancellationToken.IsCancellationRequested)
238-
{
239-
await this.LogProcessDetailsAsync(process, telemetryContext, "Sysbench", logToFile: true);
240-
process.ThrowIfErrored<WorkloadException>(process.StandardError.ToString(), ErrorReason.WorkloadFailed);
187+
using (IProcessProxy process = await this.ExecuteCommandAsync(
188+
SysbenchExecutor.PythonCommand,
189+
script + this.sysbenchExecutionArguments,
190+
this.SysbenchPackagePath,
191+
telemetryContext,
192+
cancellationToken))
193+
{
194+
if (!cancellationToken.IsCancellationRequested)
195+
{
196+
await this.LogProcessDetailsAsync(process, telemetryContext, "Sysbench", logToFile: true);
197+
process.ThrowIfErrored<WorkloadException>(process.StandardError.ToString(), ErrorReason.WorkloadFailed);
241198

242-
this.CaptureMetrics(process, telemetryContext, cancellationToken);
199+
this.CaptureMetrics(process, telemetryContext, cancellationToken);
200+
}
201+
}
243202
}
244-
}
203+
});
245204
}
246205
}
247206
}

0 commit comments

Comments
 (0)