Skip to content
Merged
97 changes: 50 additions & 47 deletions gen/portal/v1/benchmark.pb.go

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

2 changes: 1 addition & 1 deletion proto/portal/v1/benchmark.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
string benchmark_id = 1;
BenchmarkResult result = 2;
google.protobuf.Timestamp finished_at = 3;
string runner_error = 4; // runner内部のエラーメッセージ
optional string runner_error = 4; // runner内部のエラーメッセージ

Check failure on line 39 in proto/portal/v1/benchmark.proto

View workflow job for this annotation

GitHub Actions / buf check

Field "4" with name "runner_error" on message "PostJobFinishedRequest" changed cardinality from "optional with implicit presence" to "optional with explicit presence".
}

message PostJobFinishedResponse {}
Expand Down
5 changes: 3 additions & 2 deletions runner/portal/grpc/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ func (p *Portal) PostJobFinished(ctx context.Context, jobID string, finishedAt t
return fmt.Errorf("unknown result: %v", result)
}

var runnerErrStr string
var runnerErrStr *string
if runnerErr != nil {
runnerErrStr = runnerErr.Error()
errStr := runnerErr.Error()
runnerErrStr = &errStr
}

_, err := p.cl.PostJobFinished(ctx, &portalv1.PostJobFinishedRequest{
Expand Down
5 changes: 3 additions & 2 deletions runner/portal/grpc/portal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,10 @@ func TestPostJobFinished(t *testing.T) {
default:
t.Fatalf("unknown result: %v", testCase.result)
}
var runnerError string
var runnerError *string
if testCase.runnerErr != nil {
runnerError = testCase.runnerErr.Error()
errStr := testCase.runnerErr.Error()
runnerError = &errStr
}
client.EXPECT().PostJobFinished(gomock.Any(), &portalv1.PostJobFinishedRequest{
BenchmarkId: testCase.jobID,
Expand Down
1 change: 1 addition & 0 deletions server/domain/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Benchmark struct {
FinishedAt *time.Time
Score int64
Result *BenchmarkResult
ErrorMes *string
}

func NewBenchmark(instance Instance, user User) (Benchmark, error) {
Expand Down
22 changes: 12 additions & 10 deletions server/repository/db/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,17 @@ func (r *Repository) UpdateBenchmark(ctx context.Context, id uuid.UUID, benchmar

whereID := models.UpdateWhere.Benchmarks.ID.EQ(id.String())
newBenchmark := models.BenchmarkSetter{
ID: omit.From(id.String()),
InstanceID: omit.From(benchmark.Instance.ID.String()),
TeamID: omit.From(benchmark.TeamID.String()),
UserID: omit.From(benchmark.UserID.String()),
Status: omit.From(status),
CreatedAt: omit.From(benchmark.CreatedAt),
StartedAt: omitnull.FromPtr(benchmark.StartedAt),
FinishedAt: omitnull.FromPtr(benchmark.FinishedAt),
Score: omit.From(benchmark.Score),
Result: omitnull.FromPtr(result),
ID: omit.From(id.String()),
InstanceID: omit.From(benchmark.Instance.ID.String()),
TeamID: omit.From(benchmark.TeamID.String()),
UserID: omit.From(benchmark.UserID.String()),
Status: omit.From(status),
CreatedAt: omit.From(benchmark.CreatedAt),
StartedAt: omitnull.FromPtr(benchmark.StartedAt),
FinishedAt: omitnull.FromPtr(benchmark.FinishedAt),
Score: omit.From(benchmark.Score),
Result: omitnull.FromPtr(result),
ErrorMessage: omitnull.FromPtr(benchmark.ErrorMes),
}

_, err = models.Benchmarks.Update(whereID, newBenchmark.UpdateMod()).Exec(ctx, r.executor(ctx))
Expand Down Expand Up @@ -237,6 +238,7 @@ func toDomainBenchmark(benchmark *models.Benchmark) (domain.Benchmark, error) {
FinishedAt: benchmark.FinishedAt.Ptr(),
Score: benchmark.Score,
Result: result,
ErrorMes: benchmark.ErrorMessage.Ptr(),
}, nil
}

Expand Down
Loading
Loading