Commit Graph

16 Commits

Author SHA1 Message Date
Benny Halevy
c8f239ff2b tests: introduce sstables::test_env
In preparation to adding sstables_manager we want
to establish an environment for testing sstables.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-02-14 22:37:41 +02:00
Jesse Haber-Kucharsky
b39eac653d Switch to the the CMake-ified Seastar
Committer: Avi Kivity <avi@scylladb.com>
Branch: next

Switch to the the CMake-ified Seastar

This change allows Scylla to be compiled against the `master` branch of
Seastar.

The necessary changes:

- Add `-Wno-error` to prevent a Seastar warning from terminating the
  build

- The new Seastar build system generates the pkg-config files (for
  example, `seastar.pc`) at configure time, so we don't need to invoke
  Ninja to generate them

- The `-march` argument is no longer inherited from Seastar (correctly),
  so it needs to be provided independently

- Define `SEASTAR_TESTING_MAIN` so that the definition of an entry
  point is included for all unit test compilation units

- Independently link Scylla against Seastar's compiled copy of fmt in
  its build directory

- All test files use the (now public) Seastar testing headers

- Add some missing Seastar headers to source files

[avi: regenerate frozen toolchain, adjust seastar submoule]
Signed-off-by: Jesse Haber-Kucharsky <jhaberku@scylladb.com>
Message-Id: <02141f2e1ecff5cbcd56b32768356c3bf62750c4.1548820547.git.jhaberku@scylladb.com>
2019-01-30 11:17:38 +02:00
Rafael Ávila de Espíndola
684fb607c4 sstable: handle missing index entry
This patch fixes a crash when the index file is corrupted and we get
an empty index entry list.

Tests: unit (release)

Fixes: 2532

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190110202833.29333-1-espindola@scylladb.com>
2019-01-14 10:47:21 +01:00
Rafael Ávila de Espíndola
28c014351f Fix crash on corrupt sstable
The check in consume_range_tombstone was too late. Before getting to
it we would fail an assert calling to_bound_kind.

This moves the check earlier and adds a testcase.

Tests: unit (release)

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2019-01-02 17:52:07 -08:00
Rafael Ávila de Espíndola
f8c81d4d89 tests: sstables: mc: add tests with incompatible schemas
In one test the types in the schema don't match the types in the
statistics file. In another a column is missing.

The patch also updates the exceptions to have more human readable
messages.

Tests: unit (release)

Part of issue #3960.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181219233046.74229-1-espindola@scylladb.com>
2018-12-25 11:11:54 +02:00
Rafael Ávila de Espíndola
b93d8d863d Add a test with mismatched timestamps.
Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181218035931.3554-1-espindola@scylladb.com>
2018-12-18 11:30:56 +01:00
Rafael Ávila de Espíndola
4de14e6143 Add tests on broken mc range tombstones.
This tests that we diagnose both two consecutive range starts and two
consecutive range ends.
Message-Id: <20181214212608.95452-1-espindola@scylladb.com>
2018-12-15 13:53:25 +01:00
Rafael Ávila de Espíndola
f48d54543f Use read_rows_flat to test broken sstables.
The previous code was using mp_row_consumer_k_l to be as close to the
tested code as possible.

Given that it is testing for an unhandled exception, there is probably
more value in moving it to a higher level, easier to use, API.

This patch changes it to use read_rows_flat().

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20181210235016.41133-1-espindola@scylladb.com>
2018-12-14 10:14:28 +01:00
Rafael Ávila de Espíndola
51fd880892 Add tests for broken start and end composite markers. 2018-12-13 10:29:44 +01:00
Rafael Ávila de Espíndola
298873d33b Add a test with mismatched schema.
The sstable in the test is fine, but the schema thinks a static column
is regular.
2018-12-06 15:38:01 -08:00
Rafael Ávila de Espíndola
d392bc4924 Add a broken sstable test.
This sstable has a static column with clustering information.
2018-12-06 15:23:33 -08:00
Rafael Ávila de Espíndola
21199a7a5c Add a filename to a malformed_sstable_exception.
It is reasonable for parse() to throw when it finds something wrong
with the format. This seems to be the best spot to add the filename
and rethrow.

Also add a testcase to make sure we keep handling this error
gracefully.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 13:50:23 -08:00
Rafael Ávila de Espíndola
a6e25e4bd0 Try to read the full sst in broken_sst.
With this patch we use data_consume_rows to try to read the entire
sstable. The patch also adds a test with a particular corruption that
would not be found without parsing the file.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 13:47:49 -08:00
Rafael Ávila de Espíndola
b1190c58ec Convert tests to SEASTAR_THREAD_TEST_CASE.
This will simplify future changes to broken_sst.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 13:26:06 -08:00
Rafael Ávila de Espíndola
e5c5afffc9 Check the exception message.
This makes the tests a bit more strict by also checking the message
returned by the what() function.

This shows that some of the tests are out of sync with which errors
they check for. I will hopefully fix this in another pass.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 12:31:53 -08:00
Rafael Ávila de Espíndola
f9d81bcd43 Move some tests to broken_sstable_test.cc
sstable_test.cc was already a bit too big and there is potential for
having a lot of tests about broken sstables.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
2018-12-03 12:16:30 -08:00