Skip to content

Commit 3c51de0

Browse files
committed
better messaging
1 parent 0589b1a commit 3c51de0

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,28 @@ public string[] GetIntegrationsFilePaths()
203203

204204
if (!File.Exists(_integrationsFileLocation))
205205
{
206-
_output.WriteLine($"Unable to find integrations at {_profilerFileLocation}.");
206+
_output.WriteLine($"Attempt 1: Unable to find integrations at {_integrationsFileLocation}.");
207207
// Let's try the executing directory, as dotnet publish ignores the Copy attributes we currently use
208-
_profilerFileLocation = Path.Combine(
208+
_integrationsFileLocation = Path.Combine(
209209
GetExecutingProjectBin(),
210210
relativePath);
211211
}
212212

213213
if (!File.Exists(_integrationsFileLocation))
214214
{
215-
_output.WriteLine($"Fallback 1: Unable to find integrations at {_profilerFileLocation}.");
216-
// One last attempt at the actual native project directory
217-
_profilerFileLocation = Path.Combine(
218-
GetProfilerProjectBin(),
215+
_output.WriteLine($"Attempt 2: Unable to find integrations at {_integrationsFileLocation}.");
216+
// One last attempt at the solution root
217+
_integrationsFileLocation = Path.Combine(
218+
GetSolutionDirectory(),
219219
fileName);
220220
}
221221

222222
if (!File.Exists(_integrationsFileLocation))
223223
{
224-
throw new Exception($"Fallback 2: Unable to find integrations at {_integrationsFileLocation}");
224+
throw new Exception($"Attempt 3: Unable to find integrations at {_integrationsFileLocation}");
225225
}
226+
227+
_output.WriteLine($"Found integrations at {_integrationsFileLocation}.");
226228
}
227229

228230
return new[]
@@ -243,38 +245,40 @@ public string GetProfilerPath()
243245

244246
var directory = GetSampleApplicationOutputDirectory();
245247

246-
var profilerRelativePath = Path.Combine(
248+
var relativePath = Path.Combine(
247249
"profiler-lib",
248250
fileName);
249251

250252
_profilerFileLocation = Path.Combine(
251253
directory,
252-
profilerRelativePath);
254+
relativePath);
253255

254256
// TODO: get rid of the fallback options when we have a consistent convention
255257

256258
if (!File.Exists(_profilerFileLocation))
257259
{
258-
_output.WriteLine($"Unable to find profiler at {_profilerFileLocation}.");
260+
_output.WriteLine($"Attempt 1: Unable to find profiler at {_profilerFileLocation}.");
259261
// Let's try the executing directory, as dotnet publish ignores the Copy attributes we currently use
260-
_profilerFileLocation = Path.Combine(
262+
_integrationsFileLocation = Path.Combine(
261263
GetExecutingProjectBin(),
262-
profilerRelativePath);
264+
relativePath);
263265
}
264266

265267
if (!File.Exists(_profilerFileLocation))
266268
{
267-
_output.WriteLine($"Fallback 1: Unable to find profiler at {_profilerFileLocation}.");
269+
_output.WriteLine($"Attempt 2: Unable to find profiler at {_profilerFileLocation}.");
268270
// One last attempt at the actual native project directory
269-
_profilerFileLocation = Path.Combine(
271+
_integrationsFileLocation = Path.Combine(
270272
GetProfilerProjectBin(),
271273
fileName);
272274
}
273275

274276
if (!File.Exists(_profilerFileLocation))
275277
{
276-
throw new Exception($"Fallback 2: Unable to find profiler at {_profilerFileLocation}");
278+
throw new Exception($"Attempt 3: Unable to find profiler at {_profilerFileLocation}");
277279
}
280+
281+
_output.WriteLine($"Found profiler at {_profilerFileLocation}.");
278282
}
279283

280284
return _profilerFileLocation;

0 commit comments

Comments
 (0)