Skip to content

test: make the timeDecay boost test meaningful and await users role setup - #496

Open
dudanogueira wants to merge 1 commit into
weaviate:mainfrom
dudanogueira:test/fix-boost-and-users-setup
Open

dudanogueira wants to merge 1 commit into
weaviate:mainfrom
dudanogueira:test/fix-boost-and-users-setup

Conversation

@dudanogueira

Copy link
Copy Markdown
Contributor

Ports the two fixes from #486 that still apply to main after the packages/ restructure (#307). #486 now targets weaviate-client, which still has the old test/ layout.

timeDecay boost test (packages/test/node/query/integration.test.ts)

The boost decays from 2024-01-01 with a 35d scale, but #307 set createdAt to 14 days ago, 7 days ago and now. That is about 29 scale-lengths from the origin, so every object's decay factor is around 1e-20 and the boost has no real effect. not.toEqual(baseline) passes only because the near-zero values happen to break the tie between blue and green, which share a vector. createdAt is now spread around the origin (origin, +30d, +1y), so red, which is at the origin and ranks last on vector distance alone, gets a real boost.

users (packages/test/node/users/integration.test.ts)

beforeAll fired roles.delete / roles.create without awaiting them, so the role-assignment tests could start before the test role existed. This failed on main on 9 Oct ("should be able to assign a role to a user").

Testing

eslint and prettier pass. The boost suite passed 3 out of 3 runs locally against Weaviate 1.38.2. The users suite needs the RBAC instance on :8091 and is covered by CI.

…etup

The timeDecay boost decays from 2024-01-01 with a 35d scale, but every
object's createdAt was within the last 14 days, so each decay was ~1e-20
and the boost had no effect; the test passed only because the near-zero
values happened to break the tie between the two objects with the same
vector. Spread createdAt around the origin so the object at the origin
gets a real boost.

beforeAll in the users suite fired roles.delete / roles.create without
awaiting them, so the role-assignment tests could start before the test
role existed.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant