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

True Tokenless for BA and TA #882

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

True Tokenless for BA and TA #882

wants to merge 3 commits into from

Conversation

nora-codecov
Copy link
Contributor

Purpose/Motivation

TT requires certain identifiers, BA and TA don't have the identifiers in their path, so I make custom methods to get the identifiers so that BA and TA can use TT.

Links to relevant tickets

codecov/engineering-team#2298

@nora-codecov nora-codecov requested a review from a team October 10, 2024 23:23
@codecov-notifications
Copy link

codecov-notifications bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.32%. Comparing base (8945e37) to head (e5a7000).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #882   +/-   ##
=======================================
  Coverage   96.31%   96.32%           
=======================================
  Files         823      823           
  Lines       19079    19104   +25     
=======================================
+ Hits        18376    18401   +25     
  Misses        703      703           
Flag Coverage Δ
unit 92.67% <100.00%> (+0.01%) ⬆️
unit-latest-uploader 92.67% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@joseph-sentry joseph-sentry left a comment

Choose a reason for hiding this comment

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

left a couple of comments on the test results stuff that may also apply to BA

codecov_auth/authentication/repo_auth.py Outdated Show resolved Hide resolved
upload/views/helpers.py Outdated Show resolved Hide resolved
Copy link

Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.

❌ Failed Test Results:

Completed 2749 tests with 1 failed, 2742 passed and 6 skipped.

View the full list of failed tests

pytest

  • Class name: api.internal.tests.test_charts.TestChartQueryRunnerQuery
    Test name: test_query_aggregates_multiple_repository_totals

    self = <tests.test_charts.TestChartQueryRunnerQuery testMethod=test_query_aggregates_multiple_repository_totals>

    @override_settings(GITHUB_CLIENT_ID="3d44be0e772666136a13")
    def test_query_aggregates_multiple_repository_totals(self):
    query_runner = ChartQueryRunner(
    user=self.user,
    request_params={
    "owner_username": self.org.username,
    "service": self.org.service,
    "end_date": str(timezone.now()),
    "grouping_unit": "day",
    },
    )

    results = query_runner.run_query()

    assert len(results) == 1
    > assert results[0]["total_hits"] == 114
    E AssertionError: assert Decimal('14') == 114

    .../internal/tests/test_charts.py:564: AssertionError

@codecov-qa
Copy link

codecov-qa bot commented Oct 12, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2743 1 2742 6
View the top 1 failed tests by shortest run time
api.internal.tests.test_charts.TestChartQueryRunnerQuery test_query_aggregates_multiple_repository_totals
Stack Traces | 0.072s run time
self = &lt;tests.test_charts.TestChartQueryRunnerQuery testMethod=test_query_aggregates_multiple_repository_totals&gt;

    @override_settings(GITHUB_CLIENT_ID="3d44be0e772666136a13")
    def test_query_aggregates_multiple_repository_totals(self):
        query_runner = ChartQueryRunner(
            user=self.user,
            request_params={
                "owner_username": self.org.username,
                "service": self.org.service,
                "end_date": str(timezone.now()),
                "grouping_unit": "day",
            },
        )
    
        results = query_runner.run_query()
    
        assert len(results) == 1
&gt;       assert results[0]["total_hits"] == 114
E       AssertionError: assert Decimal('14') == 114

.../internal/tests/test_charts.py:564: AssertionError

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

"""
BA sends this in as git_service, TA sends this in as service.
Use this function so this Check class can be used by both views.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Could probably be return validated_data.get("git_service") or validated_data.get("service")

@@ -39,13 +39,13 @@ def has_permission(self, request, view):
class UploadSerializer(serializers.Serializer):
commit = serializers.CharField(required=True)
slug = serializers.CharField(required=True)
service = serializers.CharField(required=False) # git_service
Copy link
Contributor

Choose a reason for hiding this comment

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

How come TA can't use git_service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it's already live in prod I figured it would be a whole thing to switch over to a different var name - what do you think @joseph-sentry ?

@@ -1,8 +1,13 @@
import logging
Copy link
Contributor

Choose a reason for hiding this comment

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

This file can now be deleted right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can delete get_repository_and_owner_from_slug_and_commit, my bad I thought I had removed it! ty for catching.

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.

3 participants