Skip to content
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
7 changes: 5 additions & 2 deletions src/sqlancer/postgres/gen/PostgresTableSpaceGenerator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package sqlancer.postgres.gen;

import sqlancer.IgnoreMeException;
import sqlancer.common.query.ExpectedErrors;
import sqlancer.common.query.SQLQueryAdapter;
import sqlancer.postgres.PostgresGlobalState;
Expand All @@ -19,10 +20,12 @@ public PostgresTableSpaceGenerator(PostgresGlobalState globalState) {
}

public static SQLQueryAdapter generate(PostgresGlobalState globalState) {
// Skip tablespace generation if the option is disabled
// PostgresProvider.mapActions does not schedule this action when the option is disabled, but QPG
// selects actions by index without consulting the schedule, so the generator has to report that
// it has nothing to generate.
PostgresOptions options = globalState.getDbmsSpecificOptions();
if (!options.isTestTablespaces()) {
return null;
throw new IgnoreMeException();
}
return new PostgresTableSpaceGenerator(globalState).generateTableSpace();
}
Expand Down
25 changes: 25 additions & 0 deletions test/sqlancer/postgres/gen/TestPostgresTableSpaceGenerator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package sqlancer.postgres.gen;

import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.Test;

import sqlancer.IgnoreMeException;
import sqlancer.postgres.PostgresGlobalState;
import sqlancer.postgres.PostgresOptions;

class TestPostgresTableSpaceGenerator {

@Test
void generateIsSkippedWhenTablespacesAreDisabled() {
PostgresGlobalState state = new PostgresGlobalState();
state.setDbmsSpecificOptions(new PostgresOptions() {
@Override
public boolean isTestTablespaces() {
return false;
}
});

assertThrows(IgnoreMeException.class, () -> PostgresTableSpaceGenerator.generate(state));
}
}
Loading