Skip to content

Conversation

@dciangot
Copy link
Member

@dciangot dciangot commented Oct 3, 2025

Summary

This PR introduces comprehensive unit tests for core utility functions in the SLURM plugin:

  • stringToHex: Tests hex encoding with trailing zero removal for various input strings
  • parsingTimeFromString: Validates timestamp parsing with different formats and error handling
  • prepareImage: Tests image path handling with prefixes, annotations, and absolute paths
  • GetSessionContext: Verifies HTTP header extraction for session tracking
  • GetSessionContextMessage: Tests session message formatting
  • checkIfJidExists: Validates JID lookup functionality
  • removeJID: Tests JID removal from the main structure

Test Coverage

All tests pass successfully with comprehensive coverage of:

  • Happy path scenarios
  • Edge cases (empty strings, missing data)
  • Error conditions
  • Configuration variations

Test Plan

  • Run go test ./pkg/slurm/... -v - all tests pass
  • Verify test coverage for utility functions
  • Ensure tests are isolated and don't require external dependencies

dciangot and others added 4 commits October 9, 2025 09:42
The gopkg.in/yaml repository has been archived as of April 2025.
This commit migrates to goccy/go-yaml, which is actively maintained
and provides better YAML 1.2 spec compliance.

Changes:
- Replace gopkg.in/yaml.v2 with github.com/goccy/go-yaml v1.18.0
- Update import in pkg/slurm/func.go
- Clean up dependencies with go mod tidy

Signed-off-by: Diego Ciangottini <diego.ciangottini@pg.infn.it>
Add comprehensive unit tests covering:
- stringToHex: hex encoding with trailing zero removal
- parsingTimeFromString: timestamp parsing validation
- prepareImage: image path and prefix handling
- GetSessionContext: HTTP header extraction
- GetSessionContextMessage: session message formatting
- checkIfJidExists: JID lookup verification
- removeJID: JID removal functionality

All tests pass successfully.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Diego Ciangottini <diego.ciangottini@pg.infn.it>
Add a new Dagger function to run unit tests via 'make test' in the CI
pipeline. This enables automated unit test execution in a containerized
environment using the official Go 1.24 image.

Signed-off-by: Diego Ciangottini <diego.ciangottini@pg.infn.it>
Signed-off-by: Diego Ciangottini <diego.ciangottini@pg.infn.it>
@dciangot dciangot force-pushed the feat/add-unit-tests branch from fccc45b to e566fd6 Compare October 9, 2025 07:42
@dciangot dciangot merged commit 1fd6e90 into main Oct 9, 2025
3 checks passed
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.

2 participants