go-openai
go-openai copied to clipboard
Resolve #487: Enhance tests and fix linting issues
Describe the change
- Add randomized fields to Engine structs in tests
Describe your solution
- Implement cryptographically secure random utility functions
Tests
- Make these structs non-empty, by randomizing them, while keeping randomization logic in the internal/test directory (
internal/test/random.go). So in the end we'll get something like:
server.RegisterHandler("/v1/engines/text-davinci-003", func(w http.ResponseWriter, r *http.Request) {
resBytes, _ := json.Marshal(Engine{ID: test.randomString(), Object: test.randomString()})
fmt.Fprintln(w, string(resBytes))
})
- Address golangci-lint warnings
Additional context
- None
Issue: #487
Codecov Report
Merging #491 (5341647) into master (3589837) will increase coverage by
0.28%. Report is 7 commits behind head on master. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #491 +/- ##
==========================================
+ Coverage 97.30% 97.58% +0.28%
==========================================
Files 18 19 +1
Lines 780 871 +91
==========================================
+ Hits 759 850 +91
Misses 15 15
Partials 6 6
| Files | Coverage Δ | |
|---|---|---|
| embeddings.go | 100.00% <100.00%> (ø) |
Thank you for the PR!