fix(ooniprobe): use ooniprobe-cli-unattended for unattended runs (#714)

This diff changes the software name used by unattended runs for which
we did not override the default software name (`ooniprobe-cli`).

It will become `ooniprobe-cli-unattended`. This software name is in line
with the one we use for Android, iOS, and desktop unattended runs.

While working in this diff, I introduced string constants for the run
types and a string constant for the default software name.

See https://github.com/ooni/probe/issues/2081.
This commit is contained in:
Simone Basso 2022-04-29 13:41:09 +02:00 committed by GitHub
commit d3c5196474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 72 additions and 37 deletions

View file

@ -17,7 +17,7 @@ func TestCheckInSuccess(t *testing.T) {
Platform: "android",
ProbeASN: "AS12353",
ProbeCC: "PT",
RunType: "timed",
RunType: model.RunTypeTimed,
SoftwareName: "ooniprobe-android",
SoftwareVersion: "2.7.1",
WebConnectivity: model.OOAPICheckInConfigWebConnectivity{
@ -54,7 +54,7 @@ func TestCheckInFailure(t *testing.T) {
Platform: "android",
ProbeASN: "AS12353",
ProbeCC: "PT",
RunType: "timed",
RunType: model.RunTypeTimed,
SoftwareName: "ooniprobe-android",
SoftwareVersion: "2.7.1",
WebConnectivity: model.OOAPICheckInConfigWebConnectivity{

View file

@ -238,7 +238,7 @@ func (s *Session) KibiBytesSent() float64 {
//
// - ProbeCC: if empty, set to Session.ProbeCC();
//
// - RunType: if empty, set to "timed";
// - RunType: if empty, set to model.RunTypeTimed;
//
// - SoftwareName: if empty, set to Session.SoftwareName();
//
@ -270,7 +270,7 @@ func (s *Session) CheckIn(
config.ProbeCC = s.ProbeCC()
}
if config.RunType == "" {
config.RunType = "timed" // most conservative choice
config.RunType = model.RunTypeTimed // most conservative choice
}
if config.SoftwareName == "" {
config.SoftwareName = s.SoftwareName()

View file

@ -107,7 +107,7 @@ func TestSessionCheckInSuccessful(t *testing.T) {
if mockedClnt.Config.ProbeCC != "IT" {
t.Fatal("invalid Config.ProbeCC")
}
if mockedClnt.Config.RunType != "timed" {
if mockedClnt.Config.RunType != model.RunTypeTimed {
t.Fatal("invalid Config.RunType")
}
if mockedClnt.Config.SoftwareName != "miniooni" {