refactor: remove model.ExperimentOrchestraClient (#284)
* ongoing * while there, make sure we test everything * reorganize previous commit * ensure we have reasonable coverage in session The code in here would be better with unit tests. We have too many integration tests and the tests overall are too slow. But it's also true that I should not write a giant diff as part of this PR.
This commit is contained in:
parent
4700ba791d
commit
79e8424677
12 changed files with 200 additions and 210 deletions
|
|
@ -275,6 +275,35 @@ func (s *Session) DefaultHTTPClient() *http.Client {
|
|||
return &http.Client{Transport: s.httpDefaultTransport}
|
||||
}
|
||||
|
||||
// FetchPsiphonConfig fetches psiphon config from the API.
|
||||
func (s *Session) FetchPsiphonConfig(ctx context.Context) ([]byte, error) {
|
||||
clnt, err := s.NewOrchestraClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return clnt.FetchPsiphonConfig(ctx)
|
||||
}
|
||||
|
||||
// FetchTorTargets fetches tor targets from the API.
|
||||
func (s *Session) FetchTorTargets(
|
||||
ctx context.Context, cc string) (map[string]model.TorTarget, error) {
|
||||
clnt, err := s.NewOrchestraClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return clnt.FetchTorTargets(ctx, cc)
|
||||
}
|
||||
|
||||
// FetchURLList fetches the URL list from the API.
|
||||
func (s *Session) FetchURLList(
|
||||
ctx context.Context, config model.URLListConfig) ([]model.URLInfo, error) {
|
||||
clnt, err := s.NewOrchestraClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return clnt.FetchURLList(ctx, config)
|
||||
}
|
||||
|
||||
// KeyValueStore returns the configured key-value store.
|
||||
func (s *Session) KeyValueStore() model.KeyValueStore {
|
||||
return s.kvStore
|
||||
|
|
@ -387,7 +416,10 @@ func (s *Session) NewSubmitter(ctx context.Context) (Submitter, error) {
|
|||
|
||||
// NewOrchestraClient creates a new orchestra client. This client is registered
|
||||
// and logged in with the OONI orchestra. An error is returned on failure.
|
||||
func (s *Session) NewOrchestraClient(ctx context.Context) (model.ExperimentOrchestraClient, error) {
|
||||
//
|
||||
// This function is DEPRECATED. New code SHOULD NOT use it. It will eventually
|
||||
// be made private or entirely removed from the codebase.
|
||||
func (s *Session) NewOrchestraClient(ctx context.Context) (*probeservices.Client, error) {
|
||||
clnt, err := s.NewProbeServicesClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue