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
1 change: 1 addition & 0 deletions PatchPanda.Units/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
global using PatchPanda.Web.Db;
global using PatchPanda.Web.Entities;
global using PatchPanda.Web.Helpers;
global using PatchPanda.Services;
global using PatchPanda.Web.Services;
global using PatchPanda.Web.Services.Interfaces;
3 changes: 2 additions & 1 deletion PatchPanda.Units/Services/UpdateServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ private UpdateService CreateUpdateService(IDbContextFactory<DataContext> dbConte
_portainerService.Object,
_versionService.Object,
_jobRegistry,
_notificationService.Object
_notificationService.Object,
new HookService(new Mock<ILogger<HookService>>().Object)
);
Comment on lines +53 to 55

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Add behavioral coverage for post-update hooks.

The test factory now wires HookService, but no test configures PostUpdateHook or verifies execution, failure handling, or the Portainer skip branch. Add deterministic tests for these paths, preferably through an injectable hook abstraction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@PatchPanda.Units/Services/UpdateServiceTests.cs` around lines 53 - 55, Add
behavioral tests around the test factory’s HookService wiring, covering
successful PostUpdateHook execution, hook failure handling, and the Portainer
skip branch. Prefer injecting a deterministic hook abstraction into the relevant
UpdateService tests, and assert each path’s observable behavior without changing
unrelated service setup.

}

Expand Down
2 changes: 2 additions & 0 deletions PatchPanda.Web/Entities/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class Container : AbstractEntity

public int? MultiContainerAppId { get; set; }

public string? PostUpdateHook { get; set; }

public virtual MultiContainerApp? MultiContainerApp { get; set; }

public bool IsSecondary { get; set; }
Expand Down
321 changes: 321 additions & 0 deletions PatchPanda.Web/Migrations/20260323223243_AddPostUpdateHook.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions PatchPanda.Web/Migrations/20260323223243_AddPostUpdateHook.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PatchPanda.Web.Migrations
{
/// <inheritdoc />
public partial class AddPostUpdateHook : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PostUpdateHook",
table: "Containers",
type: "TEXT",
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PostUpdateHook",
table: "Containers");
}
}
}
3 changes: 3 additions & 0 deletions PatchPanda.Web/Migrations/DataContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("OverrideGitHubRepo")
.HasColumnType("TEXT");

b.Property<string>("PostUpdateHook")
.HasColumnType("TEXT");

b.Property<string>("Regex")
.HasColumnType("TEXT");

Expand Down
Loading