Add context to content commit
Content commit is updated to take in a context, allowing content to be committed within the same context the writer was in. This is useful when commit may be able to use more context to complete the action rather than creating its own. An example of this being useful is for the metadata implementation of content, having a context allows tests to fully create content in one database transaction by making use of the context. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -121,7 +121,7 @@ func checkContentStoreWriter(ctx context.Context, t *testing.T, cs content.Store
|
||||
}
|
||||
|
||||
preCommit := time.Now()
|
||||
if err := s.writer.Commit(0, ""); err != nil {
|
||||
if err := s.writer.Commit(ctx, 0, ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
postCommit := time.Now()
|
||||
@@ -201,7 +201,7 @@ func checkUploadStatus(ctx context.Context, t *testing.T, cs content.Store) {
|
||||
}
|
||||
|
||||
preCommit := time.Now()
|
||||
if err := w1.Commit(0, ""); err != nil {
|
||||
if err := w1.Commit(ctx, 0, ""); err != nil {
|
||||
t.Fatalf("Commit failed: %+v", err)
|
||||
}
|
||||
postCommit := time.Now()
|
||||
@@ -235,7 +235,7 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {
|
||||
}
|
||||
|
||||
preCommit := time.Now()
|
||||
if err := w1.Commit(0, "", content.WithLabels(labels)); err != nil {
|
||||
if err := w1.Commit(ctx, 0, "", content.WithLabels(labels)); err != nil {
|
||||
t.Fatalf("Commit failed: %+v", err)
|
||||
}
|
||||
postCommit := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user