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

201 testing implement mock interfaces for external dependencies #204

Merged

Conversation

GStones
Copy link
Owner

@GStones GStones commented Jan 22, 2025

No description provided.

- Added `github.com/stretchr/testify` for improved testing capabilities.
- Added indirect dependencies: `github.com/davecgh/go-spew`, `github.com/pmezard/go-difflib`, `github.com/stretchr/objx`, and `gopkg.in/yaml.v3`.
- Updated `go.mod` and `go.sum` to reflect these changes.
- Modified `setting.go` to ensure environment loading functionality.
- Enhanced tests in `document_test.go` to utilize the new `testify` assertions and improved structure for CRUD operations.
- Refactored `document.go` to support context in database operations and introduced caching strategies.

This commit enhances the testing framework and improves the overall structure of the codebase.
- Upgraded Go version from 1.22.8 to 1.23.5.
- Updated various dependencies including:
  - `agones.dev/agones` to v1.46.0
  - `firebase.google.com/go/v4` to v4.15.1
  - `github.com/ThreeDotsLabs/watermill` to v1.4.4
  - `github.com/aws/aws-sdk-go-v2` to v1.33.0 and related modules
  - `google.golang.org/api` to v0.217.0
- Enhanced README documentation for clarity and consistency.
- Minor formatting improvements in README_CN.md.

This commit ensures the project is using the latest dependencies and improves the overall documentation for better understanding.
- Introduced a detailed architecture layers diagram in both README.md and README_CN.md.
- The diagram illustrates the various layers of the application, including Application, Server, Middleware, Storage, and Integration layers.
- Enhanced documentation clarity by visually representing the relationships between components.

This update improves the understanding of the project's structure and components for developers.
@GStones GStones self-assigned this Jan 22, 2025
@GStones GStones linked an issue Jan 22, 2025 that may be closed by this pull request
"github.com/gstones/moke-kit/orm/nosql/mock/internal"
)

func NewMockDriverProvider(

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported function NewMockDriverProvider should have comment or be unexported

"github.com/gstones/moke-kit/orm/nosql/noptions"
)

type MockCollection struct {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported type MockCollection should have comment or be unexported

version noptions.Version
}

func NewMockCollection(name string) *MockCollection {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported function NewMockCollection should have comment or be unexported

return mc
}

func (m *MockCollection) GetName() string {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported method MockCollection.GetName should have comment or be unexported

return r0
}

func (m *MockCollection) Set(ctx context.Context, key key.Key, opts ...noptions.Option) (noptions.Version, error) {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported method MockCollection.Set should have comment or be unexported

return r0
}

func (m *MockCollection) Incr(ctx context.Context, key key.Key, field string, amount int32) (int64, error) {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported method MockCollection.Incr should have comment or be unexported

"github.com/gstones/moke-kit/orm/nosql/diface"
)

type MockDriverProvider struct {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported type MockDriverProvider should have comment or be unexported

logger *zap.Logger
}

func (dp *MockDriverProvider) Shutdown() error {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported method MockDriverProvider.Shutdown should have comment or be unexported

return nil
}

func (dp *MockDriverProvider) OpenDbDriver(name string) (diface.ICollection, error) {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported method MockDriverProvider.OpenDbDriver should have comment or be unexported

return mc, nil
}

func NewMockDriverProvider(

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
exported function NewMockDriverProvider should have comment or be unexported

return nerrors.ErrTooManyRetries
if err := u(); err == nil {
return nil
} else {

Choose a reason for hiding this comment

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

[golint-pr-review] reported by reviewdog 🐶
if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)

@GStones GStones merged commit 2e045be into main Jan 23, 2025
6 of 8 checks passed
@GStones GStones deleted the 201-testing-implement-mock-interfaces-for-external-dependencies branch January 23, 2025 01:58
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.

[Testing] Implement Mock Interfaces for External Dependencies
1 participant