Skip to content

Commit

Permalink
Chore: Moved riseup vpn to experimental suite and correct tests (#625)
Browse files Browse the repository at this point in the history
## Proposed Changes

  - Move riseupvpn to experimental suite
  - Correct tests appropriately.
  
|.|.|
|-|-|
|
![Screenshot_20231124_201232](https://github.com/ooni/probe-android/assets/17911892/8cd73191-d1b3-444f-b44e-b59e3847f1e3)
|
![Screenshot_20231124_201328](https://github.com/ooni/probe-android/assets/17911892/1a259298-d6bc-46e1-87be-fb24dedeb220)|
  • Loading branch information
aanorbel authored Dec 5, 2023
1 parent 98b7ab3 commit e1b88e9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static Intent newIntent(Context context, AbstractSuite testSuite) {
String experimentalLinks =
"\n\n* [STUN Reachability](https://github.com/ooni/spec/blob/master/nettests/ts-025-stun-reachability.md)" +
"\n\n* [DNS Check](https://github.com/ooni/spec/blob/master/nettests/ts-028-dnscheck.md)" +
"\n\n* [RiseupVPN](https://ooni.org/nettest/riseupvpn/)" +
"\n\n* [ECH Check](https://github.com/ooni/spec/blob/master/nettests/ts-039-echcheck.md)" +
"\n\n* [Tor Snowflake](https://ooni.org/nettest/tor-snowflake/) "+ String.format(" ( %s )",getString(R.string.Settings_TestOptions_LongRunningTest))+
"\n\n* [Vanilla Tor](https://github.com/ooni/spec/blob/master/nettests/ts-016-vanilla-tor.md) " + String.format(" ( %s )",getString(R.string.Settings_TestOptions_LongRunningTest));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public AbstractTest[] getTestList(@Nullable PreferenceManager pm) {
if (pm == null || pm.isExperimentalOn()){
list.add(new Experimental("stunreachability"));
list.add(new Experimental("dnscheck"));
list.add(new Experimental("riseupvpn"));
list.add(new Experimental("echcheck"));
if ((pm == null || pm.isLongRunningTestsInForeground()) || getAutoRun()){
list.add(new Experimental("torsf"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,38 @@
import org.openobservatory.ooniprobe.model.jsonresult.JsonResult;
import org.openobservatory.ooniprobe.model.settings.Settings;

/**
* Represents the RiseupVPN test.
*
* @deprecated This test has been demoted to experimental in <a href="https://github.com/ooni/probe-android/pull/632">Chore: Moved riseup vpn to experimental suite and correct tests</a>.
* This test has been moved to experimental because it causes too many false positive.
*/
public class RiseupVPN extends AbstractTest {
public static final String NAME = "riseupvpn";

public RiseupVPN() {
super(NAME, R.string.Test_RiseupVPN_Fullname, R.drawable.test_riseupvpn, R.string.urlTestRvpn, 15);
// NOTE: this test has been demoted to experimental (see https://github.com/ooni/probe-android/pull/632)
// and such the icon resource `R.drawable.test_riseupvpn` is not displayed anymore.
super(NAME, R.string.Test_Experimental_Fullname, 0, R.string.urlTestRvpn, 15);
}

@Override public void run(Context c, PreferenceManager pm, AppLogger logger, Gson gson, Result result, int index, AbstractTest.TestCallback testCallback) {
@Override
public void run(Context c, PreferenceManager pm, AppLogger logger, Gson gson, Result result, int index, AbstractTest.TestCallback testCallback) {
Settings settings = new Settings(c, pm, isAutoRun());
run(c, pm,logger, gson, settings, result, index, testCallback);
run(c, pm, logger, gson, settings, result, index, testCallback);
}

@Override public void onEntry(Context c, PreferenceManager pm, @NonNull JsonResult json, Measurement measurement) {
@Override
public void onEntry(Context c, PreferenceManager pm, @NonNull JsonResult json, Measurement measurement) {
super.onEntry(c, pm, json, measurement);
//When json.test_keys.transport_status is null the test is failed so the result of is_anomaly doesn't matter.
if (json.test_keys == null || json.test_keys.transport_status == null) {
measurement.is_failed = true;
return;
}
boolean isTransportBlocked = false;
isTransportBlocked = MapUtility.getOrDefaultCompat(json.test_keys.transport_status, "openvpn", "ok").equals(BLOCKED) ||
MapUtility.getOrDefaultCompat(json.test_keys.transport_status, "obfs4", "ok").equals(BLOCKED);
isTransportBlocked = MapUtility.getOrDefaultCompat(json.test_keys.transport_status, "openvpn", "ok").equals(BLOCKED) ||
MapUtility.getOrDefaultCompat(json.test_keys.transport_status, "obfs4", "ok").equals(BLOCKED);
measurement.is_anomaly = !json.test_keys.ca_cert_status || json.test_keys.api_failure != null || isTransportBlocked;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public void getTestList_experimental_on() {

List<AbstractTest> tests = Arrays.asList(suite.getTestList(pm));

assertEquals(3, tests.size());
assertEquals(4, tests.size());
assertEquals(Experimental.class, tests.get(0).getClass());
assertEquals(Experimental.class, tests.get(1).getClass());
assertEquals(Experimental.class, tests.get(2).getClass());
assertEquals(Experimental.class, tests.get(3).getClass());
assertEquals("stunreachability", tests.get(0).getName());
assertEquals("dnscheck", tests.get(1).getName());
assertEquals("echcheck", tests.get(2).getName());
assertEquals("riseupvpn", tests.get(2).getName());
assertEquals("echcheck", tests.get(3).getName());
}

@Test
Expand All @@ -50,17 +52,19 @@ public void getTestList_experimental_on_autorun_on() {

List<AbstractTest> tests = Arrays.asList(autoRunSuite.getTestList(pm));

assertEquals(5, tests.size());
assertEquals(6, tests.size());
assertEquals(Experimental.class, tests.get(0).getClass());
assertEquals(Experimental.class, tests.get(1).getClass());
assertEquals(Experimental.class, tests.get(2).getClass());
assertEquals(Experimental.class, tests.get(3).getClass());
assertEquals(Experimental.class, tests.get(4).getClass());
assertEquals(Experimental.class, tests.get(5).getClass());

assertEquals("stunreachability", tests.get(0).getName());
assertEquals("dnscheck", tests.get(1).getName());
assertEquals("echcheck", tests.get(2).getName());
assertEquals("torsf", tests.get(3).getName());
assertEquals("vanilla_tor", tests.get(4).getName());
assertEquals("riseupvpn", tests.get(2).getName());
assertEquals("echcheck", tests.get(3).getName());
assertEquals("torsf", tests.get(4).getName());
assertEquals("vanilla_tor", tests.get(5).getName());
}
}

0 comments on commit e1b88e9

Please sign in to comment.