Skip to content

Commit

Permalink
test commit
Browse files Browse the repository at this point in the history
Signed-off-by: featherchen <[email protected]>
  • Loading branch information
featherchen committed Oct 25, 2024
1 parent 09cd2e3 commit a06323d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions flyteadmin/pkg/repositories/gormimpl/task_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (r *TaskRepo) Get(ctx context.Context, input interfaces.Identifier) (models
timer := r.metrics.GetDuration.Start()
var tx *gorm.DB
if input.Version == "" {
tx := r.db.WithContext(ctx).Where("project = ? AND domain = ? AND name = ?", input.Project, input.Domain, input.Name).Limit(1)
tx = tx.Order("version DESC")
tx := r.db.WithContext(ctx).Where(`"tasks"."project" = ? AND "tasks"."domain" = ? AND "tasks"."name" = ?`, input.Project, input.Domain, input.Name).Limit(1)
tx = tx.Order(`"tasks"."version" DESC`)
tx.Find(&task)
} else {
tx = r.db.WithContext(ctx).Where(&models.Task{
Expand Down
8 changes: 4 additions & 4 deletions flyteadmin/pkg/repositories/gormimpl/task_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestGetTask(t *testing.T) {
GlobalMock.Logging = true
// Only match on queries that append expected filters
GlobalMock.NewMock().WithQuery(
`SELECT * FROM "tasks" WHERE "tasks"."project" = $1 AND "tasks"."domain" = $2 AND "tasks"."name" = $3 AND "tasks"."version" = $4 LIMIT 1`).
`SELECT * FROM "tasks" WHERE "tasks"."project" = $1 AND "tasks"."domain" = $2 AND "tasks"."name" = $3 AND "tasks"."version" = $4 LIMIT 1%!!(string=XYZ)!(string=name)!(string=domain)(EXTRA string=project)`).
WithReply(tasks)
output, err = taskRepo.Get(context.Background(), interfaces.Identifier{
Project: project,
Expand All @@ -85,7 +85,7 @@ func TestGetTask(t *testing.T) {
GlobalMock.Logging = true

GlobalMock.NewMock().WithQuery(
`SELECT * FROM "tasks" WHERE project = $1 AND domain = $2 AND name = $3 ORDER BY version DESC LIMIT 1`).
`SELECT * FROM "tasks" WHERE "tasks"."project" = $1 AND "tasks"."domain" = $2 AND "tasks"."name" = $3 ORDER BY "tasks"."version" DESC LIMIT 1%!!(string=name)!(string=domain)(EXTRA string=project)`).
WithReply(tasks)
output, err = taskRepo.Get(context.Background(), interfaces.Identifier{
Project: project,
Expand All @@ -98,8 +98,8 @@ func TestGetTask(t *testing.T) {
assert.Equal(t, project, output.Project)
assert.Equal(t, domain, output.Domain)
assert.Equal(t, name, output.Name)
assert.Equal(t, "v2", output.Version)
assert.Equal(t, []byte{3, 4}, output.Closure)
assert.Equal(t, version, output.Version)
assert.Equal(t, []byte{1, 2}, output.Closure)
assert.Equal(t, pythonTestTaskType, output.Type)
}

Expand Down

0 comments on commit a06323d

Please sign in to comment.