Skip to content

Commit

Permalink
fix gitea integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkoSekulic committed Nov 7, 2024
1 parent 1663c41 commit c68946b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
3 changes: 3 additions & 0 deletions backend/tests/Designer.Tests/Fixtures/GiteaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public Lazy<HttpClient> GiteaClient
public string OAuthApplicationClientId { get; private set; }
public string OAuthApplicationClientSecret { get; private set; }

public string DbConnectionString => _postgreSqlContainer?.GetConnectionString();

private static AsyncRetryPolicy GiteaClientRetryPolicy => Policy.Handle<HttpRequestException>()
.Or<SocketException>()
.WaitAndRetryAsync(4, retryAttempt => TimeSpan.FromSeconds(retryAttempt));
Expand All @@ -68,6 +70,7 @@ private async Task BuildAndStartPostgreSqlContainerAsync()
.WithUsername("gitea")
.WithPassword("gitea")
.WithDatabase("gitea")
.WithExposedPort(TestUrlsProvider.GetRandomAvailablePort())
.Build();
await _postgreSqlContainer.StartAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,25 +143,29 @@ protected Stream GenerateGiteaOverrideConfigStream()
""AppLocation"": ""{templateLocation}/App""
}},
""OidcLoginSettings"": {{
""ClientId"": ""{GiteaFixture.OAuthApplicationClientId}"",
""ClientSecret"": ""{GiteaFixture.OAuthApplicationClientSecret}"",
""Authority"": ""{TestUrlsProvider.Instance.GiteaUrl}"",
""Scopes"": [
""openid"",
""profile"",
""write:activitypub"",
""write:admin"",
""write:issue"",
""write:misc"",
""write:notification"",
""write:organization"",
""write:package"",
""write:repository"",
""write:user""
],
""RequireHttpsMetadata"": false,
""CookieExpiryTimeInMinutes"" : 59
}}
""ClientId"": ""{GiteaFixture.OAuthApplicationClientId}"",
""ClientSecret"": ""{GiteaFixture.OAuthApplicationClientSecret}"",
""Authority"": ""{TestUrlsProvider.Instance.GiteaUrl}"",
""Scopes"": [
""openid"",
""profile"",
""write:activitypub"",
""write:admin"",
""write:issue"",
""write:misc"",
""write:notification"",
""write:organization"",
""write:package"",
""write:repository"",
""write:user""
],
""RequireHttpsMetadata"": false,
""CookieExpiryTimeInMinutes"" : 59
}},
""PostgreSQLSettings"": {{
""ConnectionString"": ""{GiteaFixture.DbConnectionString}"",
""DesignerDbPwd"": """"
}}
}}
";
var configStream = new MemoryStream(Encoding.UTF8.GetBytes(configOverride));
Expand Down

0 comments on commit c68946b

Please sign in to comment.