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

Initialize Trtl Database #52

Merged
merged 4 commits into from Nov 1, 2022
Merged

Initialize Trtl Database #52

merged 4 commits into from Nov 1, 2022

Conversation

bbengfort
Copy link
Contributor

Scope of changes

Initializes trtl database for Tenant.

Fixes SC-10265

Type of change

  • new feature
  • bug fix
  • documentation
  • testing
  • technical debt
  • other (describe)

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #10265: Spike: Postgres or Trtl?.

Copy link
Contributor

@daniellemaxwell daniellemaxwell left a comment

Choose a reason for hiding this comment

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

Good start!

@@ -136,6 +148,10 @@ func TestAllowAllOrigins(t *testing.T) {
require.True(t, conf.AllowAllOrigins(), "expected allow all origins to be true when * is set")
}

func TestDatabase(t *testing.T) {
// TODO: test DatabaseConfig validation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daniellemaxwell would you mind creating a story for this please?

Comment on lines +24 to +39
// TODO: do we need any other key components for listing tenants?
return t.ID.MarshalBinary()
}

func (t *Tenant) Namespace() string {
return TenantNamespace
}

func (t *Tenant) MarshalValue() ([]byte, error) {
// TODO: look into bson, msgpack, etc.
return json.Marshal(t)
}

func (t *Tenant) UnmarshalValue(data []byte) error {
// TODO: look into bson, msgpack, etc.
return json.Unmarshal(data, t)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daniellemaxwell would you mind creating a story for these TODOs please?

if conf.Insecure {
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
} else {
// TODO: connect with mtls
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daniellemaxwell would you mind creating a story for connecting to trtl using mTLS please?

// database is already connected then nothing will happen).
func Connect(conf config.DatabaseConfig) (err error) {
if conf.Testing {
// TODO: setup mock trtl connection for testing
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@daniellemaxwell (last one I think) would you mind creating two stories for this TODO:

  1. Implement mock trtl for testing tenant (this TODO)
  2. Implement tests for the db package interactions with trtl (not this TODO but related)

@codecov
Copy link

codecov bot commented Nov 1, 2022

Codecov Report

Merging #52 (dca8d00) into main (8e7c0fe) will decrease coverage by 2.92%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
- Coverage   52.32%   49.39%   -2.93%     
==========================================
  Files          47       49       +2     
  Lines        3232     3468     +236     
==========================================
+ Hits         1691     1713      +22     
- Misses       1359     1566     +207     
- Partials      182      189       +7     
Flag Coverage Δ
unittests 49.39% <ø> (-2.93%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...om/rotationalio/ensign/pkg/tenant/config/config.go 52.77% <0.00%> (-21.14%) ⬇️
...ithub.com/rotationalio/ensign/pkg/tenant/tenant.go 82.06% <0.00%> (-2.27%) ⬇️
...github.com/rotationalio/ensign/pkg/tenant/db/db.go 11.84% <0.00%> (ø)
...b.com/rotationalio/ensign/pkg/tenant/db/tenants.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bbengfort bbengfort merged commit 95505c3 into main Nov 1, 2022
@bbengfort bbengfort deleted the sc-10265/trtl branch November 1, 2022 22: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.

None yet

2 participants