Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes 4015: Force order by issued-date desc #7

Merged
merged 3 commits into from
Apr 24, 2024
Merged
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
10 changes: 5 additions & 5 deletions compose_files/pulp/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
timeout: 3s

migration_service:
image: "quay.io/cloudservices/pulp-rpm-ubi:latest"
image: "quay.io/cloudservices/pulp-ubi:latest"
depends_on:
postgres:
condition: service_healthy
Expand All @@ -32,7 +32,7 @@ services:
- "pulp:/var/lib/pulp"

set_init_password_service:
image: "quay.io/cloudservices/pulp-rpm-ubi:latest"
image: "quay.io/cloudservices/pulp-ubi:latest"
command: set_init_password.sh
depends_on:
migration_service:
Expand All @@ -53,7 +53,7 @@ services:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]

pulp_api:
image: "quay.io/cloudservices/pulp-rpm-ubi:latest"
image: "quay.io/cloudservices/pulp-ubi:latest"
deploy:
replicas: 1
command: [ 'pulp-api' ]
Expand All @@ -75,7 +75,7 @@ services:
restart: always

pulp_content:
image: "quay.io/cloudservices/pulp-rpm-ubi:latest"
image: "quay.io/cloudservices/pulp-ubi:latest"
deploy:
replicas: 1
command: [ 'pulp-content' ]
Expand Down Expand Up @@ -111,7 +111,7 @@ services:
restart: always

pulp_worker:
image: "quay.io/cloudservices/pulp-rpm-ubi:latest"
image: "quay.io/cloudservices/pulp-ubi:latest"
deploy:
replicas: 1
command: [ 'pulp-worker' ]
Expand Down
20 changes: 10 additions & 10 deletions internal/test/integration/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,21 @@ func (r *RpmSuite) TestRpmRepositoryVersionErrataListFilter() {
singleList, total, err := r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Search: ""}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), total, 5)
assert.Equal(r.T(), total, 6)

// test limit
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{}, tangy.PageOptions{Limit: 1})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), len(singleList), 1)
assert.Equal(r.T(), total, 5)
assert.Equal(r.T(), total, 6)

// test offset
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{}, tangy.PageOptions{Offset: 3})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), len(singleList), 2)
assert.Equal(r.T(), total, 5)
assert.Equal(r.T(), len(singleList), 3)
assert.Equal(r.T(), total, 6)

// id filter partial
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Search: "0055"}, tangy.PageOptions{})
Expand All @@ -283,13 +283,13 @@ func (r *RpmSuite) TestRpmRepositoryVersionErrataListFilter() {
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Type: []string{"security"}}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), total, 3)
assert.Equal(r.T(), total, 4)

// multiple types filter
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Type: []string{"security", "enhancement"}}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), total, 4)
assert.Equal(r.T(), total, 5)

// type filter partial (empty)
emptyList, total, err := r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Type: []string{"secu"}}, tangy.PageOptions{})
Expand All @@ -298,19 +298,19 @@ func (r *RpmSuite) TestRpmRepositoryVersionErrataListFilter() {
assert.Equal(r.T(), total, 0)

// severity filter
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"low"}}, tangy.PageOptions{})
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"Low"}}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), total, 1)

// multiple severities filter
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"low", "Unknown"}}, tangy.PageOptions{})
singleList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"Low", "Unknown"}}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.NotEmpty(r.T(), singleList)
assert.Equal(r.T(), total, 5)
assert.Equal(r.T(), total, 3)

// severity filter partial (empty)
emptyList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"lo"}}, tangy.PageOptions{})
emptyList, total, err = r.tangy.RpmRepositoryVersionErrataList(context.Background(), []string{*firstVersionHref}, tangy.ErrataListFilters{Severity: []string{"Lo"}}, tangy.PageOptions{})
require.NoError(r.T(), err)
assert.Empty(r.T(), emptyList)
assert.Equal(r.T(), total, 0)
Expand Down
2 changes: 1 addition & 1 deletion pkg/tangy/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (t *tangyImpl) RpmRepositoryVersionErrataList(ctx context.Context, hrefs []
args["limit"] = pageOpts.Limit
args["offset"] = pageOpts.Offset
rows, err := conn.Query(ctx, queryOpen+innerUnion+filterQuery+
" ORDER BY re.id ASC, re.title ASC, re.issued_date ASC, re.type ASC, re.severity ASC LIMIT @limit OFFSET @offset",
" ORDER BY re.issued_date DESC, re.title ASC, re.type ASC, re.severity ASC LIMIT @limit OFFSET @offset",
args)
if err != nil {
return nil, 0, err
Expand Down
Loading