Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@ghost
Copy link

@ghost ghost commented Nov 18, 2024

Purpose/Motivation

What is the feature? Why is this being done?

Links to relevant tickets

What does this PR do?

Include a brief description of the changes in this PR. Bullet points are your friend.

Notes to Reviewer

Anything to note to the team? Any tips on how to review, or where to start?

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@ghost ghost self-requested a review as a code owner November 18, 2024 20:20
@codecov-notifications
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@codecov
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.03%. Comparing base (ace92d6) to head (fb28d63).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #991   +/-   ##
=======================================
  Coverage   96.03%   96.03%           
=======================================
  Files         828      828           
  Lines       19166    19166           
=======================================
  Hits        18407    18407           
  Misses        759      759           
Flag Coverage Δ
unit 92.31% <ø> (ø)
unit-latest-uploader 92.31% <ø> (ø)

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.

@codecov-qa
Copy link

codecov-qa bot commented Nov 18, 2024

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2690 4 2686 6
View the top 3 failed tests by shortest run time
upload/tests/views/test_upload_coverage.py::::test_deactivated_repo
Stack Traces | 0.035s run time
db = None

    def test_deactivated_repo(db):
        repository = RepositoryFactory(
            name="the_repo",
            author__username="codecov",
            author__service="github",
            active=True,
            activated=False,
        )
        repository.save()
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        client = APIClient()
        client.credentials(HTTP_AUTHORIZATION="token " + repository.upload_token)
        response = client.post(url, {"commit_sha": "abc123"}, format="json")
        assert response.status_code == 400
>       assert "This repository is deactivated" in str(response.json())
E       assert 'This repository is deactivated' in "{'commitid': ['This field may not be null.']}"
E        +  where "{'commitid': ['This field may not be null.']}" = str({'commitid': ['This field may not be null.']})
E        +    where {'commitid': ['This field may not be null.']} = functools.partial(<bound method ClientMixin._parse_json of <rest_framework.test.APIClient object at 0x7f9158041370>>, <Response status_code=400, "application/json">)()
E        +      where functools.partial(<bound method ClientMixin._parse_json of <rest_framework.test.APIClient object at 0x7f9158041370>>, <Response status_code=400, "application/json">) = <Response status_code=400, "application/json">.json

.../tests/views/test_upload_coverage.py:73: AssertionError
upload/tests/views/test_upload_coverage.py::::test_upload_coverage_post
Stack Traces | 0.038s run time
db = None, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f9138a80860>

    def test_upload_coverage_post(db, mocker):
        mocker.patch.object(
            CanDoCoverageUploadsPermission, "has_permission", return_value=True
        )
        presigned_put_mock = mocker.patch(
            "services.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
    
        repository = RepositoryFactory(
            name="the_repo1", author__username="codecov", author__service="github"
        )
        commit = CommitFactory(repository=repository)
        repository.save()
        commit.save()
    
        owner = repository.author
        client = APIClient()
        client.force_authenticate(user=owner)
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        response = client.post(
            url,
            {
                "branch": "branch",
                "ci_service": "ci_service",
                "ci_url": "ci_url",
                "code": "code",
                "commit_sha": commit.commitid,
                "flags": ["flag1", "flag2"],
                "job_code": "job_code",
                "version": "version",
            },
            format="json",
        )
        response_json = response.json()
        upload = ReportSession.objects.filter(
            report__commit=commit,
            report__code="code",
            upload_extras={"format_version": "v1"},
        ).first()
>       assert response.status_code == 201
E       assert 400 == 201
E        +  where 400 = <Response status_code=400, "application/json">.status_code

.../tests/views/test_upload_coverage.py:147: AssertionError
upload/tests/views/test_upload_coverage.py::::test_upload_coverage_post_shelter
Stack Traces | 0.038s run time
db = None, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f914823f1d0>

    @override_settings(SHELTER_SHARED_SECRET="shelter-shared-secret")
    def test_upload_coverage_post_shelter(db, mocker):
        mocker.patch.object(
            CanDoCoverageUploadsPermission, "has_permission", return_value=True
        )
        presigned_put_mock = mocker.patch(
            "services.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
    
        repository = RepositoryFactory(
            name="the_repo", author__username="codecov", author__service="github"
        )
        commit = CommitFactory(repository=repository)
        repository.save()
        commit.save()
    
        owner = repository.author
        client = APIClient()
        client.force_authenticate(user=owner)
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        response = client.post(
            url,
            {
                "branch": "branch",
                "ci_service": "ci_service",
                "ci_url": "ci_url",
                "code": "code",
                "commit_sha": commit.commitid,
                "flags": ["flag1", "flag2"],
                "job_code": "job_code",
                "storage_path": "shelter/test/path.txt",
                "version": "version",
            },
            headers={
                "X-Shelter-Token": "shelter-shared-secret",
                "User-Agent": "codecov-cli/0.4.7",
            },
            format="json",
        )
        response_json = response.json()
        upload = ReportSession.objects.filter(
            report__commit=commit,
            report__code="code",
            upload_extras={"format_version": "v1"},
        ).first()
>       assert response.status_code == 201
E       assert 400 == 201
E        +  where 400 = <Response status_code=400, "application/json">.status_code

.../tests/views/test_upload_coverage.py:250: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@codecov-public-qa
Copy link

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2690 4 2686 6
View the top 3 failed tests by shortest run time
upload/tests/views/test_upload_coverage.py::test_deactivated_repo
Stack Traces | 0.035s run time
db = None

    def test_deactivated_repo(db):
        repository = RepositoryFactory(
            name="the_repo",
            author__username="codecov",
            author__service="github",
            active=True,
            activated=False,
        )
        repository.save()
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        client = APIClient()
        client.credentials(HTTP_AUTHORIZATION="token " + repository.upload_token)
        response = client.post(url, {"commit_sha": "abc123"}, format="json")
        assert response.status_code == 400
&gt;       assert "This repository is deactivated" in str(response.json())
E       assert 'This repository is deactivated' in "{'commitid': ['This field may not be null.']}"
E        +  where "{'commitid': ['This field may not be null.']}" = str({'commitid': ['This field may not be null.']})
E        +    where {'commitid': ['This field may not be null.']} = functools.partial(&lt;bound method ClientMixin._parse_json of &lt;rest_framework.test.APIClient object at 0x7f9158041370&gt;&gt;, &lt;Response status_code=400, "application/json"&gt;)()
E        +      where functools.partial(&lt;bound method ClientMixin._parse_json of &lt;rest_framework.test.APIClient object at 0x7f9158041370&gt;&gt;, &lt;Response status_code=400, "application/json"&gt;) = &lt;Response status_code=400, "application/json"&gt;.json

.../tests/views/test_upload_coverage.py:73: AssertionError
upload/tests/views/test_upload_coverage.py::test_upload_coverage_post
Stack Traces | 0.038s run time
db = None, mocker = &lt;pytest_mock.plugin.MockerFixture object at 0x7f9138a80860&gt;

    def test_upload_coverage_post(db, mocker):
        mocker.patch.object(
            CanDoCoverageUploadsPermission, "has_permission", return_value=True
        )
        presigned_put_mock = mocker.patch(
            "services.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
    
        repository = RepositoryFactory(
            name="the_repo1", author__username="codecov", author__service="github"
        )
        commit = CommitFactory(repository=repository)
        repository.save()
        commit.save()
    
        owner = repository.author
        client = APIClient()
        client.force_authenticate(user=owner)
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        response = client.post(
            url,
            {
                "branch": "branch",
                "ci_service": "ci_service",
                "ci_url": "ci_url",
                "code": "code",
                "commit_sha": commit.commitid,
                "flags": ["flag1", "flag2"],
                "job_code": "job_code",
                "version": "version",
            },
            format="json",
        )
        response_json = response.json()
        upload = ReportSession.objects.filter(
            report__commit=commit,
            report__code="code",
            upload_extras={"format_version": "v1"},
        ).first()
&gt;       assert response.status_code == 201
E       assert 400 == 201
E        +  where 400 = &lt;Response status_code=400, "application/json"&gt;.status_code

.../tests/views/test_upload_coverage.py:147: AssertionError
upload/tests/views/test_upload_coverage.py::test_upload_coverage_post_shelter
Stack Traces | 0.038s run time
db = None, mocker = &lt;pytest_mock.plugin.MockerFixture object at 0x7f914823f1d0&gt;

    @override_settings(SHELTER_SHARED_SECRET="shelter-shared-secret")
    def test_upload_coverage_post_shelter(db, mocker):
        mocker.patch.object(
            CanDoCoverageUploadsPermission, "has_permission", return_value=True
        )
        presigned_put_mock = mocker.patch(
            "services.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
    
        repository = RepositoryFactory(
            name="the_repo", author__username="codecov", author__service="github"
        )
        commit = CommitFactory(repository=repository)
        repository.save()
        commit.save()
    
        owner = repository.author
        client = APIClient()
        client.force_authenticate(user=owner)
        repo_slug = f"{repository.author.username}::::{repository.name}"
        url = reverse(
            "new_upload.upload_coverage",
            args=[repository.author.service, repo_slug],
        )
        response = client.post(
            url,
            {
                "branch": "branch",
                "ci_service": "ci_service",
                "ci_url": "ci_url",
                "code": "code",
                "commit_sha": commit.commitid,
                "flags": ["flag1", "flag2"],
                "job_code": "job_code",
                "storage_path": "shelter/test/path.txt",
                "version": "version",
            },
            headers={
                "X-Shelter-Token": "shelter-shared-secret",
                "User-Agent": "codecov-cli/0.4.7",
            },
            format="json",
        )
        response_json = response.json()
        upload = ReportSession.objects.filter(
            report__commit=commit,
            report__code="code",
            upload_extras={"format_version": "v1"},
        ).first()
&gt;       assert response.status_code == 201
E       assert 400 == 201
E        +  where 400 = &lt;Response status_code=400, "application/json"&gt;.status_code

.../tests/views/test_upload_coverage.py:250: AssertionError

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2024

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@ghost ghost added this pull request to the merge queue Nov 21, 2024
Merged via the queue into main with commit 70ec67f Nov 21, 2024
18 of 19 checks passed
@ghost ghost deleted the tony/upload-coverage-consistent-namings branch November 21, 2024 20:15
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants