Skip to content

add initial tests - #14

Merged
juruen merged 1 commit into
mainfrom
juruen/add-tests
Mar 17, 2025
Merged

add initial tests#14
juruen merged 1 commit into
mainfrom
juruen/add-tests

Conversation

@juruen

Copy link
Copy Markdown
Collaborator

Context

First of all, apologies for the large PR. I'm happy to split it into smaller PRs if needed.

As we talked off-line, we need to start adding tests to the codebase. Although black-box tests will probably be easier to read and maintain, I wanted to make sure that we have some testing in place, even if it's not the best choice yet.

This PR adds tests that are based in testing each one of the individual tools by mocking the GitHub client. We verify that:

  • The tool schema is expected
  • A successful use of the tool by checking that:
    • The expected arguments are passed to the GitHub client
    • The response is parsed and returned
    • A limited number of permutations for those those tools that have optional args
  • A failed use case of the tool

We have added a few simple test helper functions to try to simplify the tests a bit.

CopilotAI review requested due to automatic review settings March 17, 2025 12:18

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces initial tests for various GitHub tools and updates HTTP status code checks for consistency.

  • Added tests for GitHub issues, code scanning, pull requests, and server functionality.
  • Updated conditional checks to use http.Status* constants in place of literal numeric values.
  • Established helper functions for MCP request creation and text result extraction.

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
pkg/github/issues_test.goIntroduces tests for issue retrieval and comment creation.
pkg/github/code_scanning_test.goAdds tests for fetching code scanning alerts.
pkg/github/server_test.goTests the authenticated user tool and accepted error detection.
pkg/github/helper_test.goProvides helper functions used across tests.
pkg/github/server.goReplaces hardcoded status codes with http.Status* constants.
pkg/github/pullrequests.goApplies consistent status code constants and adds accepted error check.
pkg/github/repositories.goUpdates status code constants; potential issue in fork repository handling.
pkg/github/issues.goReplaces numeric status codes with http.Status* constants.
pkg/github/code_scanning.goUses http.Status* constants for response validation.
Files not reviewed (1)
  • go.mod: Language not supported

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

Comment threadpkg/github/repositories.go Outdated

@SamMorrowDrumsSamMorrowDrums left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To me it feels ok to have a big PR to introduce the tests. I mean stacked PRs is a possibility, but I am happy to just make rapid progress, and then be more strict once we have an MVP.

@juruen
juruen merged commit fa0e36c into mainMar 17, 2025
@juruen
juruen deleted the juruen/add-tests branch March 17, 2025 17:45
DaleSeo pushed a commit to DaleSeo/github-mcp-server that referenced this pull request Oct 24, 2025
…or Grafana server to resolve issue where new changes are not being built (github#14)
Co-authored-by: naf <fed@notafed.org>
SamMorrowDrums added a commit that referenced this pull request Feb 18, 2026
Pin all three Dockerfile base images to their SHA256 digests to resolve
code scanning alerts for unpinned Docker images. Dependabot docker
ecosystem is already configured and will keep these digests up to date.
- node:20-alpine (alert #14)
- golang:1.25.7-alpine (alert #15)
- gcr.io/distroless/base-debian12 (proactive)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SamMorrowDrums added a commit that referenced this pull request Feb 18, 2026
Pin all three Dockerfile base images to their SHA256 digests to resolve
code scanning alerts for unpinned Docker images. Dependabot docker
ecosystem is already configured and will keep these digests up to date.
- node:20-alpine (alert #14)
- golang:1.25.7-alpine (alert #15)
- gcr.io/distroless/base-debian12 (proactive)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for freeto 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

@juruen@SamMorrowDrums