Skip to content

Commit

Permalink
Merge pull request #311 from mmd-osm/patch/cleanup3
Browse files Browse the repository at this point in the history
Various minor cleanups
  • Loading branch information
mmd-osm authored Nov 24, 2023
2 parents 5bc5d95 + 3adb8c5 commit a0152cd
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 375 deletions.
6 changes: 3 additions & 3 deletions Dockerfile_bookworm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vim:set ft=dockerfile:
FROM debian:bookworm AS builder
FROM debian:bookworm-slim AS builder

ENV DEBIAN_FRONTEND=noninteractive

Expand All @@ -21,11 +21,11 @@ COPY . ./
# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap

FROM debian:bookworm
FROM debian:bookworm-slim

RUN apt-get update -qq && \
apt-get install -y \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile_trixie
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vim:set ft=dockerfile:
FROM debian:trixie AS builder
FROM debian:trixie-slim AS builder

ENV DEBIAN_FRONTEND=noninteractive

Expand All @@ -21,7 +21,7 @@ COPY . ./
# Compile, install and remove source
RUN ./autogen.sh && \
./configure --enable-static --disable-shared --enable-yajl CXXFLAGS="-Wall -Wextra -Wpedantic -Wno-unused-parameter" && \
make -j3 && \
make -j3 check TESTS= && \
make check || ( cat ./test-suite.log ; exit 1 ) && \
strip openstreetmap-cgimap

Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ ___test_test_parse_osmchange_input_CPPFLAGS=$(AM_CPPFLAGS) $(CATCH2_CPPFLAGS)
___test_test_parse_osmchange_input_SOURCES=\
../test/test_parse_osmchange_input.cpp

___test_test_parse_changeset_input_CPPFLAGS=$(AM_CPPFLAGS) $(CATCH2_CPPFLAGS)
___test_test_parse_changeset_input_SOURCES=\
../test/test_parse_changeset_input.cpp

Expand Down
20 changes: 5 additions & 15 deletions test/test_apidb_backend_changeset_downloads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ void test_changeset_select_node(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(1);
int num = sel->select_historical_by_changesets(ids);
int num = sel->select_historical_by_changesets({1});
assert_equal<int>(num, 1, "should have selected one element from changeset 1");

test_formatter f;
Expand Down Expand Up @@ -100,9 +98,7 @@ void test_changeset_select_way(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(2);
int num = sel->select_historical_by_changesets(ids);
int num = sel->select_historical_by_changesets({2});
assert_equal<int>(num, 2, "number of ways (2) selected from changeset 1");

test_formatter f;
Expand Down Expand Up @@ -158,9 +154,7 @@ void test_changeset_select_relation(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(2);
int num = sel->select_historical_by_changesets(ids);
int num = sel->select_historical_by_changesets({2});
assert_equal<int>(num, 1, "number of relations (1) selected from changeset 1");

test_formatter f;
Expand Down Expand Up @@ -207,9 +201,7 @@ void test_changeset_redacted(test_database &tdb) {
auto sel = tdb.get_data_selection();

{
std::vector<osm_changeset_id_t> ids;
ids.push_back(2);
int num = sel->select_historical_by_changesets(ids);
int num = sel->select_historical_by_changesets({2});
assert_equal<int>(num, 0, "number of elements (0) selected by regular user from changeset 2");

test_formatter f;
Expand All @@ -221,9 +213,7 @@ void test_changeset_redacted(test_database &tdb) {
// as a moderator, should have all redacted elements shown.
sel->set_redactions_visible(true);
{
std::vector<osm_changeset_id_t> ids;
ids.push_back(2);
int num = sel->select_historical_by_changesets(ids);
int num = sel->select_historical_by_changesets({2});
assert_equal<int>(num, 1, "number of elements (1) selected by moderator from changeset 2");

test_formatter f;
Expand Down
21 changes: 5 additions & 16 deletions test/test_apidb_backend_changesets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ void test_negative_changeset_ids(test_database &tdb) {
sel->check_node_visibility(7), data_selection::exists,
"node 7 visibility");

std::vector<osm_nwr_id_t> ids;
ids.push_back(6);
ids.push_back(7);
if (sel->select_nodes(ids) != 2) {
if (sel->select_nodes({6,7}) != 2) {
throw std::runtime_error("Selecting 2 nodes failed");
}

Expand Down Expand Up @@ -89,9 +86,7 @@ void test_changeset(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(1);
int num = sel->select_changesets(ids);
int num = sel->select_changesets({1});
assert_equal<int>(num, 1, "should have selected one changeset.");

std::chrono::system_clock::time_point t = parse_time("2015-09-05T17:15:33Z");
Expand Down Expand Up @@ -133,9 +128,7 @@ void test_nonpublic_changeset(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(4);
int num = sel->select_changesets(ids);
int num = sel->select_changesets({4});
assert_equal<int>(num, 1, "should have selected one changeset.");

std::chrono::system_clock::time_point t = parse_time("2015-09-05T20:13:23Z");
Expand Down Expand Up @@ -182,9 +175,7 @@ void test_changeset_with_tags(test_database &tdb) {
);
auto sel = tdb.get_data_selection();

std::vector<osm_changeset_id_t> ids;
ids.push_back(2);
int num = sel->select_changesets(ids);
int num = sel->select_changesets({2});
assert_equal<int>(num, 1, "should have selected one changeset.");

std::chrono::system_clock::time_point t = parse_time("2015-09-05T20:33:00Z");
Expand Down Expand Up @@ -221,9 +212,7 @@ void check_changeset_with_comments_impl(
data_selection& sel,
bool include_discussion) {

std::vector<osm_changeset_id_t> ids;
ids.push_back(3);
int num = sel.select_changesets(ids);
int num = sel.select_changesets({3});
assert_equal<int>(num, 1, "should have selected one changeset.");

if (include_discussion) {
Expand Down
Loading

0 comments on commit a0152cd

Please sign in to comment.