Skip to content

Conversation

yinwang-wish
Copy link
Contributor

Comment on lines +120 to +122
if strings.HasPrefix(p.conf.SchemaPath, "example.json") {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need to skip watcher for unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if not skip, unit test will stuck on watcher. Cuz watcher is setup on Configure func, and unit test also need call this func: https://github.com/wish/mongoproxy/blob/master/pkg/mongoproxy/plugins/schema/schema_test.go#L19-L21

Copy link
Contributor

@yiguo-wish yiguo-wish Jul 27, 2022

Choose a reason for hiding this comment

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

my understanding is that watcher should not be blocking, it's a async go routing
the whole mongoproxy service will be continuously running to serve requests, but this watcher function should not be a blocking one

return err
}

<-done
Copy link
Contributor

Choose a reason for hiding this comment

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

have we tested it with sending queries to local mongodb? if my reading/understanding is correct, this done will block SchemaPlugin.Configure() return, thus no query could be processed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants