Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static IResourceBuilder<SqliteResource> WithSqliteWeb(this IResourceBuild
var resourceBuilder = builder.ApplicationBuilder.AddResource(resource)
.WithImage(SqliteContainerImageTags.SqliteWebImage, SqliteContainerImageTags.SqliteWebTag)
.WithImageRegistry(SqliteContainerImageTags.SqliteWebRegistry)
.WithImagePullPolicy(ImagePullPolicy.Always)
.WithHttpEndpoint(targetPort: 8080, name: "http")
.WithArgs(builder.Resource.DatabaseFileName)
.WithBindMount(builder.Resource.DatabasePath, "/data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,13 @@ public async Task SqliteWebResourceConfigured()
Assert.Equal(SqliteContainerImageTags.SqliteWebTag, imageAnnotation.Tag);
Assert.Equal(SqliteContainerImageTags.SqliteWebRegistry, imageAnnotation.Registry);

var env = await sqliteWeb.GetArgumentListAsync();
var envVar = Assert.Single(env);
Assert.Equal(sqlite.Resource.DatabaseFileName, envVar);
Assert.True(sqliteWeb.TryGetAnnotationsOfType<ContainerImagePullPolicyAnnotation>(out var imagePullPolicyAnnotations));
var imagePullPolicyAnnotation = Assert.Single(imagePullPolicyAnnotations);
Assert.Equal(ImagePullPolicy.Always, imagePullPolicyAnnotation.ImagePullPolicy);

var args = await sqliteWeb.GetArgumentListAsync();
var databaseFileName = Assert.Single(args);
Assert.Equal(sqlite.Resource.DatabaseFileName, databaseFileName);

Assert.True(sqliteWeb.TryGetAnnotationsOfType<ContainerMountAnnotation>(out var bindMountAnnotations));
var bindMountAnnotation = Assert.Single(bindMountAnnotations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ public async Task ResourceStartsAndDbFileExists()
Assert.True(File.Exists(dataSource.ToString()));
}

[Fact]
public async Task SqliteWebResourceStarts()
{
var resourceName = "sqlite-sqliteweb";
await fixture.ResourceNotificationService.WaitForResourceHealthyAsync(resourceName).WaitAsync(TimeSpan.FromMinutes(5));
var httpClient = fixture.CreateHttpClient(resourceName, endpointName: "http");

var response = await httpClient.GetAsync("/");

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Contains("SQLite Web", await response.Content.ReadAsStringAsync());
}

[Fact]
public async Task ApiServiceCreateTestItemWithSqliteClient()
{
Expand Down Expand Up @@ -72,4 +85,4 @@ public class Blog
public required string Url { get; set; }

}
}
}
Loading