Skip to content

Commit 736734a

Browse files
nchapagain001Nirjan Chapagain
andauthored
[Bug Fix] Remove mandatory layout (#654)
* fixing layout error * Adding UT * Keeping this PR short. I've removed the following feature: Remove --package-store requirement in bootstrap subcommand. --------- Co-authored-by: Nirjan Chapagain <nchapagain@example.com>
1 parent f450e44 commit 736734a

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/VirtualClient/VirtualClient.Main/BootstrapCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ protected void Validate()
136136
//
137137
// e.g.
138138
// --key-vault="https://any.vault.azure.net?cid=8cdebecc...&tid=42005d4d...&crti=ANY&crts=any.corp.azure.com"
139-
if (string.IsNullOrWhiteSpace(this.AccessToken)
139+
if (string.IsNullOrWhiteSpace(this.AccessToken)
140140
&& string.IsNullOrWhiteSpace(this.TokenFilePath)
141-
&& string.IsNullOrWhiteSpace(this.TenantId)
141+
&& string.IsNullOrWhiteSpace(this.TenantId)
142142
&& (this.KeyVaultStore as DependencyKeyVaultStore)?.Credentials == null)
143143
{
144144
throw new ArgumentException(
@@ -153,4 +153,4 @@ protected void Validate()
153153
}
154154
}
155155
}
156-
}
156+
}

src/VirtualClient/VirtualClient.Main/CommandLineParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,4 +642,4 @@ private static string[] PreprocessArguments(params string[] args)
642642
return preprocessedArgs;
643643
}
644644
}
645-
}
645+
}

src/VirtualClient/VirtualClient.Main/ExecuteProfileCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ protected void SetHostMetadataTelemetryProperties(IEnumerable<string> profiles,
669669
new Dictionary<string, object>
670670
{
671671
{ "exitWait", this.ExitWait },
672-
{ "layout", this.Layout.ToString() },
672+
{ "layout", this.Layout?.ToString() },
673673
{ "logToFile", this.LogToFile },
674674
{ "iterations", this.Iterations?.ProfileIterations },
675675
{ "profiles", string.Join(",", profiles.Select(p => Path.GetFileName(p))) },

src/VirtualClient/VirtualClient.UnitTests/ExecuteProfileCommandTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,5 +538,18 @@ private static Tuple<string, string> GetAccessTokenPair()
538538

539539
return new Tuple<string, string>(decodedOriginalBytes, decodedObscuredBytes);
540540
}
541+
542+
[Test]
543+
public void SetHostMetadataTelemetryPropertiesDoesNotThrowWhenLayoutIsNull()
544+
{
545+
// Layout is not mandatory for setting host metadata properties.
546+
this.command.Layout = null;
547+
548+
string profile = "TEST-WORKLOAD-PROFILE.json";
549+
List<string> profiles = new List<string> { this.mockFixture.GetProfilesPath(profile) };
550+
551+
// Act & Assert - Should not throw expection
552+
Assert.DoesNotThrow(() => this.command.SetHostMetadataTelemetryProperties(profiles, this.mockFixture.Dependencies));
553+
}
541554
}
542555
}

0 commit comments

Comments
 (0)