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:
Simone Basso
2021-04-02 12:03:18 +02:00
committed by GitHub
parent 4700ba791d
commit 79e8424677
12 changed files with 200 additions and 210 deletions
+3 -18
View File
@@ -5,29 +5,14 @@ import (
"net/http"
)
// ExperimentOrchestraClient is the experiment's view of
// a client for querying the OONI orchestra API.
type ExperimentOrchestraClient interface {
// CheckIn calls the check-in API.
CheckIn(ctx context.Context, config CheckInConfig) (*CheckInInfo, error)
// FetchPsiphonConfig returns psiphon config from the API.
FetchPsiphonConfig(ctx context.Context) ([]byte, error)
// FetchTorTargets returns tor targets from the API.
FetchTorTargets(ctx context.Context, cc string) (map[string]TorTarget, error)
// FetchURLList returns URLs from the API.
// This method is deprecated and will be removed soon.
FetchURLList(ctx context.Context, config URLListConfig) ([]URLInfo, error)
}
// ExperimentSession is the experiment's view of a session.
type ExperimentSession interface {
GetTestHelpersByName(name string) ([]Service, bool)
DefaultHTTPClient() *http.Client
FetchPsiphonConfig(ctx context.Context) ([]byte, error)
FetchTorTargets(ctx context.Context, cc string) (map[string]TorTarget, error)
FetchURLList(ctx context.Context, config URLListConfig) ([]URLInfo, error)
Logger() Logger
NewOrchestraClient(ctx context.Context) (ExperimentOrchestraClient, error)
ProbeCC() string
ResolverIP() string
TempDir() string