Skip to content

Commit

Permalink
fix: fix the TestFlagBridge model (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry authored Sep 27, 2024
1 parent 100a69d commit 85f3174
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions database/models/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,14 @@ class DailyTestRollup(CodecovBaseModel, MixinBaseClassNoExternalID):
)


class TestFlagBridge(CodecovBaseModel, MixinBaseClassNoExternalID):
class TestFlagBridge(CodecovBaseModel):
__tablename__ = "reports_test_results_flag_bridge"

id_ = Column("id", types.BigInteger, primary_key=True)

test_id = Column(types.Text, ForeignKey("reports_test.id"))
test = relationship(Test, backref=backref("test_flag_bridges"))

repoid = Column(types.Integer, ForeignKey("repos.repoid"))
repository = relationship("Repository", backref=backref("test_flag_bridges"))

flag_id = Column(
"flag_id", types.BigInteger, ForeignKey("reports_repositoryflag.id")
)
Expand Down
3 changes: 1 addition & 2 deletions tasks/test_results_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ def _bulk_write_tests_to_db(

if test_id not in existing_tests:
test_flag_bridge_data += [
{"test_id": test_id, "repoid": repoid, "flag_id": repo_flags[flag]}
for flag in flags
{"test_id": test_id, "flag_id": repo_flags[flag]} for flag in flags
]

test_instance_data.append(
Expand Down
1 change: 0 additions & 1 deletion tasks/tests/unit/test_test_results_processor_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ def test_upload_processor_task_call_existing_test_diff_flags_hash(
]
for bridge in test_flag_bridges:
assert bridge.flag == repo_flag
assert bridge.repoid == repoid

assert len(tests) == 5
assert len(test_instances) == 4
Expand Down

0 comments on commit 85f3174

Please sign in to comment.