Skip to content

Commit

Permalink
ensure validation only happens if we run e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz committed Feb 13, 2024
1 parent 821cdc6 commit f4689bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build/scripts/CommandLine.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ open Microsoft.FSharp.Reflection
open System
open Bullseye

type TestSuite = All | Unit | Integration | E2E | Skip_All | Skip_E2E
type TestSuite = All | Unit | Integration | E2E | Skip_All | Skip_E2E
with
member this.SuitName =
match FSharpValue.GetUnionFields(this, typeof<TestSuite>) with
| case, _ -> case.Name.ToLowerInvariant()

type Build =
| [<CliPrefix(CliPrefix.None);SubCommand>] Clean
Expand Down
1 change: 1 addition & 0 deletions build/scripts/Targets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ let private runTests suite _ =
let settingsArg = ["-s"; "tests/.runsettings"]
let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net8.0"]
exec {
env (Map ["TEST_SUITE", suite.SuitName])
run "dotnet" (
["test"; "-c"; "release"; "--no-restore"; "--no-build"; logger]
@ settingsArg
Expand Down
10 changes: 10 additions & 0 deletions tests/Elastic.OpenTelemetry.EndToEndTests/GlobalSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public override void OnBeforeTestsRun()
.AddEnvironmentVariables()
.AddUserSecrets<DotNetRunApplication>()
.Build();

var testSuite = Environment.GetEnvironmentVariable("TEST_SUITE");

//only validate credentials if we are actually running the e2e suite
if (testSuite == null || (
!testSuite.Equals("e2e", StringComparison.InvariantCultureIgnoreCase)
&& !testSuite.Equals("all", StringComparison.InvariantCultureIgnoreCase))
)
return;

try
{
configuration["E2E:Endpoint"].Should()
Expand Down

0 comments on commit f4689bf

Please sign in to comment.