From 75155f770df1e7a63fa9476cc5078806fa7b89ef Mon Sep 17 00:00:00 2001 From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:38:38 +0300 Subject: [PATCH] Allow manual workflow dispatch (#126) --- .github/workflows/ci.yml | 4 +++- .../BaseFixture.cs | 15 +-------------- .../LaunchItem/AsyncLaunchItemFixture.cs | 10 +++++++--- .../ReportPortal.Client.IntegrationTests.csproj | 2 +- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf183a5e..c957b00d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,8 @@ name: CI -on: push +on: + - push + - workflow_dispatch env: CONFIGURATION: Release diff --git a/test/ReportPortal.Client.IntegrationTests/BaseFixture.cs b/test/ReportPortal.Client.IntegrationTests/BaseFixture.cs index 748918ac..98e50665 100644 --- a/test/ReportPortal.Client.IntegrationTests/BaseFixture.cs +++ b/test/ReportPortal.Client.IntegrationTests/BaseFixture.cs @@ -40,20 +40,7 @@ public BaseFixture() var uiToken = JsonSerializer.Deserialize(uiTokenJson); - using (var apiTokenRequestMessage = new HttpRequestMessage(HttpMethod.Get, "uat/sso/me/apitoken")) - { - apiTokenRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", uiToken.AccessToken); - using (var apiTokenResponseMessage = httpClient.SendAsync(apiTokenRequestMessage).GetAwaiter().GetResult()) - { - apiTokenResponseMessage.EnsureSuccessStatusCode(); - - var apiTokenJson = apiTokenResponseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - - var apiToken = JsonSerializer.Deserialize(apiTokenJson); - - Service = new Service(new Uri($"{url}/api/v1"), ProjectName, apiToken.AccessToken); - } - } + Service = new Service(new Uri($"{url}/api/v1"), ProjectName, uiToken.AccessToken); } } } diff --git a/test/ReportPortal.Client.IntegrationTests/LaunchItem/AsyncLaunchItemFixture.cs b/test/ReportPortal.Client.IntegrationTests/LaunchItem/AsyncLaunchItemFixture.cs index 5a44ff03..37fe3de8 100644 --- a/test/ReportPortal.Client.IntegrationTests/LaunchItem/AsyncLaunchItemFixture.cs +++ b/test/ReportPortal.Client.IntegrationTests/LaunchItem/AsyncLaunchItemFixture.cs @@ -1,5 +1,6 @@ using FluentAssertions; using ReportPortal.Client.Abstractions.Requests; +using ReportPortal.Client.Abstractions.Responses; using System; using System.Threading.Tasks; using Xunit; @@ -36,10 +37,13 @@ public async Task StartFinishDeleteLaunch() var message = await Service.AsyncLaunch.FinishAsync(launch.Uuid, finishLaunchRequest); Assert.Equal(launch.Uuid, message.Uuid); - // race condition: get a chance the launch is in database before deleting it - await Task.Delay(1000); + LaunchResponse gotLaunch = null; - var gotLaunch = await Service.Launch.GetAsync(launch.Uuid); + // wait until async launch will be processed + Func getLaunchAction = async () => gotLaunch = await Service.Launch.GetAsync(launch.Uuid); + await getLaunchAction.Should().NotThrowAfterAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(1)); + + Assert.NotNull(gotLaunch); Assert.Equal("StartFinishDeleteAsyncLaunch", gotLaunch.Name); gotLaunch.StartTime.Should().BeCloseTo(startLaunchRequest.StartTime, precision: 1); gotLaunch.EndTime.Should().BeCloseTo(finishLaunchRequest.EndTime, precision: 1); diff --git a/test/ReportPortal.Client.IntegrationTests/ReportPortal.Client.IntegrationTests.csproj b/test/ReportPortal.Client.IntegrationTests/ReportPortal.Client.IntegrationTests.csproj index ae0618c3..18421070 100644 --- a/test/ReportPortal.Client.IntegrationTests/ReportPortal.Client.IntegrationTests.csproj +++ b/test/ReportPortal.Client.IntegrationTests/ReportPortal.Client.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net6.0;net48;netcoreapp3.1; + net6.0;net48; true