Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use full path to dynamo in tests #14934

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions test/Libraries/TestServices/TestSessionConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ public class TestSessionConfiguration
/// </summary>
public Version RequestedLibraryVersion2 { get; private set; }

private static string TryGetFullPath(string dynamoCoreDirectory)
{
string output = dynamoCoreDirectory;
if (!string.IsNullOrEmpty(dynamoCoreDirectory))
{
try
{
if (!Path.IsPathFullyQualified(dynamoCoreDirectory))
{// Try to get the full path
output = Path.GetFullPath(dynamoCoreDirectory);
}
}
catch
{}
}
return output;
}

/// <summary>
/// This constructor does not read configuration from a config file, the configuration properties are
/// set directly by the parameters passed to this constructor.
Expand All @@ -41,7 +59,7 @@ public class TestSessionConfiguration
/// <param name="requestedVersion"></param>
public TestSessionConfiguration(string dynamoCoreDirectory, Version requestedVersion)
{
DynamoCorePath = dynamoCoreDirectory;
DynamoCorePath = TryGetFullPath(dynamoCoreDirectory);
RequestedLibraryVersion2 = requestedVersion;
}

Expand All @@ -68,6 +86,8 @@ public TestSessionConfiguration(string dynamoCoreDirectory, string configFileDir
configPath = Path.Combine(configFileDirectory, CONFIG_FILE_NAME);
}

dynamoCoreDirectory = TryGetFullPath(dynamoCoreDirectory);

// If a config file cannot be found, fall back to
// using the executing assembly's directory for core
// and version 219 for the shape manager.
Expand All @@ -86,7 +106,9 @@ public TestSessionConfiguration(string dynamoCoreDirectory, string configFileDir
var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);

var dir = GetAppSetting(config, "DynamoBasePath");
DynamoCorePath = string.IsNullOrEmpty(dir) ? dynamoCoreDirectory : dir;


DynamoCorePath = string.IsNullOrEmpty(dir) ? dynamoCoreDirectory : TryGetFullPath(dir);

// if an old client supplies an older format test config we should still load it.
var versionStrOld = GetAppSetting(config, "RequestedLibraryVersion");
Expand Down
Loading