Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Moved riseup vpn to experimental suite and correct tests #625

Merged
merged 16 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,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());
}
}
Loading