Skip to content

Commit

Permalink
fix: remove caching in the user info endpoint in the backend (#192)
Browse files Browse the repository at this point in the history
* chor: remove caching in the user info endpoint in the backend

* chor: remove caching in the user info endpoint in the backend

* removed warning
  • Loading branch information
ashukequinor authored Dec 12, 2024
1 parent db26f05 commit f1cce90
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
run: docker logs test-container

- name: Cleanup Docker containers
run: docker rm -f $(docker ps -a -q)
run: docker rm -f $(docker ps -a -q)
1 change: 1 addition & 0 deletions src/ChemDec.Api/ChemDec.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>4da654b3-752c-4bfe-9a96-f05b76086cfa</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/ChemDec.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@
var defaultBackChannel = new HttpClient();
defaultBackChannel.DefaultRequestHeaders.Add("Origin", "chemcom");
optionsB.Backchannel = defaultBackChannel;
}).EnableTokenAcquisitionToCallDownstreamApi(e => { })
.AddInMemoryTokenCaches();
});
//.EnableTokenAcquisitionToCallDownstreamApi(e => { }) this require caching and there is no downstream api
//.AddInMemoryTokenCaches();

builder.Services.AddAuthorization(options =>
{
Expand Down
25 changes: 21 additions & 4 deletions src/IntegrationTests/Fixtures/TestSetupFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Testcontainers.MsSql;
using System.Security.Claims;
using Domain.Users;
using System.Runtime.InteropServices;

namespace IntegrationTests.Fixtures;

Expand All @@ -32,13 +33,29 @@ public class TestSetupFixture : IAsyncLifetime, IDisposable
public IUserProvider UserProvider { get; private set; }

private readonly ApplicationDbContext _dbContext;
private readonly MsSqlContainer _msSqlContainer
= new MsSqlBuilder().Build();
private readonly MsSqlContainer _msSqlContainer;
//= new MsSqlBuilder().Build();

//TODO: Add Faker
//TODO: Refactor to use IClassFixture<>
public TestSetupFixture()
{
// Workaround to fix issue with Testcontainers.MsSql on Linux
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
_msSqlContainer = new MsSqlBuilder()
.WithImage(
"mcr.microsoft.com/mssql/server:2022-latest"
)
.WithPortBinding(1433, true)
.Build();
}
else
{
_msSqlContainer = new MsSqlBuilder()
.WithPortBinding(1433, true)
.Build();
}
_msSqlContainer.StartAsync().Wait();
ConfigurationBuilder configurationBuilder = new();
Configuration = configurationBuilder
Expand Down Expand Up @@ -151,9 +168,9 @@ public void Dispose()

}

public async Task InitializeAsync()
public Task InitializeAsync()
{

return Task.CompletedTask;
}

public async Task DisposeAsync()
Expand Down

0 comments on commit f1cce90

Please sign in to comment.