Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): hide godoc for changes follower test fixtures #447

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

mojito317
Copy link
Contributor

PR summary

Previously there were leaked out parts from test fixtures in our published documentation. Excluding test files can happen with adding _test postfix to the filename.

I used go doc --all -u features on our main and this branch and exported the diff into this file:
features.diff.txt

But I leave here the diff under this toggle too.
diff --git a/old_features.out b/features.out
index 624feaa..7e69179 100644
--- a/old_features.out
+++ b/features.out
@@ -3,11 +3,6 @@ package features // import "github.com/IBM/cloudant-go-sdk/features"
 
 CONSTANTS
 
-const (
-	maxBatches       = math.MaxInt / BatchSize
-	StatusBrokenJson = 600
-	StatusBadIO      = 601
-)
 const BatchSize int = 10000
     BatchSize is the default number of document to pull in a single request.
 
@@ -32,32 +27,10 @@ VARIABLES
 var expRetryGate int = int(math.Log(float64(LongpollTimeout/baseDelay)) / math.Log(2))
     Once we reach this number of retries we'll be capping the backoff
 
-var limits []int = []int{
-	100,
-	BatchSize,
-	BatchSize + 123,
-}
-var noErrors []int = []int{}
-var terminalErrors []int = []int{
-	http.StatusBadRequest,
-	http.StatusUnauthorized,
-	http.StatusForbidden,
-	http.StatusNotFound,
-}
-var transientErrors []int = []int{
-	http.StatusTooManyRequests,
-	http.StatusInternalServerError,
-	http.StatusBadGateway,
-	http.StatusGatewayTimeout,
-	StatusBrokenJson,
-	StatusBadIO,
-}
 
 FUNCTIONS
 
-func ErrorText(err int) string
 func isTerminalError(code int) bool
-func runner(cf *ChangesFollower, c runnerConfig) (int, error)
 func validateOptions(o *cloudantv1.PostChangesOptions) error
 
 TYPES
@@ -202,62 +175,6 @@ func (ci ChangesItem) Item() (cloudantv1.ChangesResultItem, error)
     Item is a ChangesItem's getter for cloudantv1.ChangesResultItem that either
     returns an acquired item or an error received during its fetch.
 
-type MockChangesGenerator struct {
-	batches     int
-	errs        []int
-	batchNum    int
-	returnError bool
-}
-
-func NewMockChangesGenerator(batches int, errs []int) *MockChangesGenerator
-
-func (mg *MockChangesGenerator) Next() (statusCode int, data []byte)
-
-type MockDbInfoGenerator struct {
-	resp []byte
-}
-
-func NewDbInfoGenerator(docCount, docSize int) *MockDbInfoGenerator
-
-func (mg *MockDbInfoGenerator) Next() (statusCode int, data []byte)
-
-type MockErrorGenerator struct {
-	err  int
-	data []byte
-}
-
-func NewMockErrorGenerator(err int) *MockErrorGenerator
-
-func (mg *MockErrorGenerator) Next() (statusCode int, data []byte)
-
-type MockGenerator interface {
-	Next() (statusCode int, data []byte)
-}
-
-type MockServer struct {
-	server        *httptest.Server
-	mockGenerator MockGenerator
-	dbInfo        MockGenerator
-	callNumber    atomic.Int32
-	limit         atomic.Int32
-}
-
-func NewMockErrorServer(err int) *MockServer
-
-func NewMockServer(batches int, errs []int) *MockServer
-
-func (ms *MockServer) CallNumber() int
-
-func (ms *MockServer) Limit() int
-
-func (ms *MockServer) Start() *cloudantv1.CloudantV1
-
-func (ms *MockServer) Stop()
-
-func (ms *MockServer) WithDbInfo(docCount, docSize int) *MockServer
-
-func (ms *MockServer) WithDbInfoError(err int) *MockServer
-
 type Mode int
     Mode are enums for changes follower's operation mode.
 
@@ -284,9 +201,3 @@ type changesItems struct {
 	error error
 }
 
-type runnerConfig struct {
-	mode      Mode
-	timeout   time.Duration
-	stopAfter int
-}
-

PR Checklist

Please make sure that your PR fulfills the following requirements:

  • The commit message follows the
    Angular Commit Message Guidelines.
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • New tests
  • Build/CI related changes
  • Documentation content changes
  • Other (please describe)

What is the current behavior?

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@mojito317 mojito317 self-assigned this Jan 18, 2024
Copy link
Member

@eiri eiri left a comment

Choose a reason for hiding this comment

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

Feels a bit hackish, but I can live with that.

@mojito317 mojito317 merged commit 4da761c into main Jan 22, 2024
7 checks passed
@mojito317 mojito317 deleted the hide-internal-docs branch January 22, 2024 08:52
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.

3 participants