Skip to content

Conversation

AkshayCdra
Copy link

Description:

  • Extract cache warmup logic into standalone function for better testability
  • Add unit tests for Redis GET handler

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • I have reviewed the code comments and documentation for clarity.

Copy link
Member

@aryanmehrotra aryanmehrotra left a comment

Choose a reason for hiding this comment

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

code should not be changed for adding tests

@Umang01-hash
Copy link
Member

@AkshayCdr the coverage of examples/http-server-using-redis was 94.6% previously and after this PR also it is same 94.6%. How is this a improvement in coverage?

In the main.go:

		err := ctx.Redis.Set(ctx, cacheKey, cacheValue, 0).Err()
		if err != nil {
			ctx.Logger.Errorf("Failed to warm up cache: %v", err)
			return err // Return the error to halt startup if caching fails.
		}

Only this part is uncovered currenly, if we can cover it then it will be an improvement for sure!

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.

4 participants