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

Implemented a foundation for gRPC streaming #786

Merged
merged 57 commits into from
Oct 6, 2022
Merged

Conversation

JosteinLindhom
Copy link
Contributor

No description provided.

@ghost
Copy link

ghost commented Sep 21, 2022

Review on Crocodile

@coveralls
Copy link

coveralls commented Sep 23, 2022

Pull Request Test Coverage Report for Build 3189968399

  • 141 of 305 (46.23%) changed or added relevant lines in 9 files are covered.
  • 267 unchanged lines in 11 files lost coverage.
  • Overall coverage increased (+3.3%) to 27.673%

Changes Missing Coverage Covered Lines Changed/Added Lines %
web/webserver.go 0 5 0.0%
web/interceptor/tokens.go 11 23 47.83%
web/interceptor/user_auth.go 33 49 67.35%
web/interceptor/access_control.go 58 75 77.33%
web/stream/service.go 33 50 66.0%
web/interceptor/req_validation.go 0 26 0.0%
web/interceptor/metrics.go 0 34 0.0%
web/stream/stream.go 0 37 0.0%
Files with Coverage Reduction New Missed Lines %
scm/test_helper.go 1 0%
web/interceptor/access_control.go 1 78.31%
scm/scm.go 2 0%
web/interceptor/tokens.go 2 54.55%
web/access_control.go 9 74.47%
scm/helper.go 13 66.15%
database/gormdb.go 15 79.31%
web/groups.go 24 60.0%
web/scm_helpers.go 34 47.39%
scm/mock.go 35 67.85%
Totals Coverage Status
Change from base Build 3150196469: 3.3%
Covered Lines: 2989
Relevant Lines: 10801

💛 - Coveralls

@codecov-commenter
Copy link

codecov-commenter commented Sep 23, 2022

Codecov Report

Merging #786 (9561da8) into master (c3ba67a) will increase coverage by 2.98%.
The diff coverage is 42.52%.

@@            Coverage Diff             @@
##           master     #786      +/-   ##
==========================================
+ Coverage   22.31%   25.29%   +2.98%     
==========================================
  Files          88       89       +1     
  Lines       10416    10425       +9     
==========================================
+ Hits         2324     2637     +313     
+ Misses       7819     7494     -325     
- Partials      273      294      +21     
Flag Coverage Δ
unittests 25.29% <42.52%> (+2.98%) ⬆️

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

Impacted Files Coverage Δ
web/interceptor/metrics.go 17.02% <0.00%> (-8.79%) ⬇️
web/interceptor/req_validation.go 0.00% <0.00%> (ø)
web/stream/stream.go 0.00% <0.00%> (ø)
web/webserver.go 0.00% <0.00%> (ø)
web/interceptor/tokens.go 44.18% <40.90%> (-8.76%) ⬇️
web/stream/service.go 50.90% <50.90%> (ø)
web/interceptor/user_auth.go 64.58% <64.58%> (-22.38%) ⬇️
web/interceptor/access_control.go 74.39% <72.97%> (-7.81%) ⬇️
web/quickfeed_service.go 32.59% <100.00%> (+1.82%) ⬆️
... and 15 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more


func (u *UserInterceptor) WrapStreamingHandler(next connect.StreamingHandlerFunc) connect.StreamingHandlerFunc {
return connect.StreamingHandlerFunc(func(ctx context.Context, conn connect.StreamingHandlerConn) error {
cookie := conn.RequestHeader().Get(auth.Cookie)
Copy link
Contributor

Choose a reason for hiding this comment

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

Most of this code is similar to WrapUnary. Can we make a shared function that can be called from both?

web/interceptor/tokens.go Outdated Show resolved Hide resolved
web/stream/pool.go Outdated Show resolved Hide resolved
web/stream/pool.go Outdated Show resolved Hide resolved
web/stream/service.go Outdated Show resolved Hide resolved
web/stream/service.go Outdated Show resolved Hide resolved
web/stream/service.go Outdated Show resolved Hide resolved
meling added 5 commits October 4, 2022 19:41
CloseBy() has no error to return; just returned nil.

Calling Run() in TestStreamClose() can ignore the error; we are
not interested in the error in this test.
web/stream/service.go Outdated Show resolved Hide resolved
return stream
}

func (s *Service[T]) AddStream(userID uint64, st StreamInterface[T]) StreamInterface[T] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing doc comment. Also note that since the StreamInterface has GetID we don't actually need to provide the userID argument for this method.

Would it be better to rename st to stream?

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, if we can remove this method, then we could simplify the StreamInterface by removing the GetID method. But maybe I'm not seeing all uses of this...

web/stream/service.go Show resolved Hide resolved
web/stream/service.go Outdated Show resolved Hide resolved
web/stream/stream.go Outdated Show resolved Hide resolved
web/stream/stream_helper_test.go Outdated Show resolved Hide resolved
web/stream/stream_helper_test.go Outdated Show resolved Hide resolved
web/stream/service.go Outdated Show resolved Hide resolved
for _, data := range s.Messages {
msgMsp[data.Msg]++
}
t.Log(msgMsp)
Copy link
Contributor

Choose a reason for hiding this comment

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

Once we feel comfortable that the test is working as expected, maybe we should remove the printing.

go func() {
defer wg.Done()
err := st.Run()
t.Log(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Once we feel comfortable that the test is working as expected, maybe we should remove the printing.

@meling meling merged commit b354efa into master Oct 6, 2022
@meling meling deleted the submission-stream branch October 6, 2022 15:57
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