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

Fix race condition in GtfsModuleTest #5357

Merged
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 @@ -11,12 +11,12 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.opentripplanner.ConstantsForTests;
import org.opentripplanner.gtfs.graphbuilder.GtfsBundle;
import org.opentripplanner.gtfs.graphbuilder.GtfsModule;
import org.opentripplanner.model.calendar.ServiceDateInterval;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.test.support.VariableSource;
import org.opentripplanner.transit.model.framework.Deduplicator;
import org.opentripplanner.transit.service.StopModel;
import org.opentripplanner.transit.service.TransitModel;
Expand Down Expand Up @@ -73,18 +73,20 @@ static GtfsBundle bundle(String feedId) {
return b;
}

static Stream<Arguments> interliningCases = Stream.of(
Arguments.of(List.of(bundle("A")), 2),
Arguments.of(List.of(bundle("A"), bundle("B")), 4),
Arguments.of(List.of(bundle("A"), bundle("B"), bundle("C")), 6)
);
static List<Arguments> interliningCases() {
return List.of(
Arguments.of(List.of(bundle("A")), 2),
Arguments.of(List.of(bundle("A"), bundle("B")), 4),
Arguments.of(List.of(bundle("A"), bundle("B"), bundle("C")), 6)
);
}

/**
* We test that the number of stay-seated transfers grows linearly (not exponentially) with the
* number of GTFS input feeds.
*/
@ParameterizedTest(name = "Bundles {0} should generate {1} stay-seated transfers")
@VariableSource("interliningCases")
@MethodSource("interliningCases")
public void interline(List<GtfsBundle> bundles, int expectedTransfers) {
var model = buildTestModel();

Expand Down