# - name: Run webservice tests
# run: docker-compose -f docker-compose.test.yml run bugzilla6.test test_webservices
- test_bugzilla6:
+ test_bugzilla6_mysql:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run bmo specific tests
run: docker-compose -f docker-compose.test.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
+ test_bugzilla6_pg:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install docker-compose
+ run: sudo apt update && sudo apt install -y docker-compose
+ - name: Build the Docker images
+ run: docker compose -f docker-compose.test-pg.yml build
+ - name: Run bmo specific tests
+ run: docker-compose -f docker-compose.test-pg.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
+
sub set_class {
my ($self) = @_;
- Bugzilla->dbh->do(
- "REPLACE INTO attachment_storage_class (id, storage_class) VALUES (?, ?)",
- undef, $self->attach_id, $self->data_type);
+ if ($self->data_exists()) {
+ Bugzilla->dbh->do(
+ "UPDATE attachment_storage_class SET storage_class = ? WHERE id = ?",
+ undef, $self->data_type, $self->attach_id);
+ }
+ else {
+ Bugzilla->dbh->do(
+ "INSERT INTO attachment_storage_class (id, storage_class) VALUES (?, ?)",
+ undef, $self->attach_id, $self->data_type);
+ }
return $self;
}
sub set_data {
my ($self, $data) = @_;
my $dbh = Bugzilla->dbh;
- my $sth
- = $dbh->prepare(
- "REPLACE INTO attach_data (id, thedata) VALUES (?, ?)"
- );
- $sth->bind_param(1, $self->attach_id);
- $sth->bind_param(2, $data, $dbh->BLOB_TYPE);
- $sth->execute();
+ if ($self->data_exists()) {
+ my $sth
+ = $dbh->prepare(
+ "UPDATE attach_data SET thedata = ? WHERE id = ?"
+ );
+ $sth->bind_param(1, $data, $dbh->BLOB_TYPE);
+ $sth->bind_param(2, $self->attach_id);
+ $sth->execute();
+ }
+ else {
+ my $sth
+ = $dbh->prepare(
+ "INSERT INTO attach_data (id, thedata) VALUES (?, ?)"
+ );
+ $sth->bind_param(1, $self->attach_id);
+ $sth->bind_param(2, $data, $dbh->BLOB_TYPE);
+ $sth->execute();
+ }
return $self;
}
print "\n" if $output;
}
+sub _bz_check_dbd {
+ my ($db, $output) = @_;
+
+ my $dbd = $db->{dbd};
+ unless (vers_cmp($dbd, $output)) {
+ my $sql_server = $db->{name};
+ my $command = install_command($dbd);
+ my $root = ROOT_USER;
+ my $dbd_mod = $dbd->{module};
+ my $dbd_ver = $dbd->{version};
+ die <<EOT;
+
+For $sql_server, Bugzilla requires that perl's $dbd_mod $dbd_ver or later be
+installed. To install this module, run the following command (as $root):
+
+ $command
+
+EOT
+ }
+}
+
sub bz_check_server_version {
my ($self, $db, $output) = @_;
my $dbh = Bugzilla->dbh;
my $sth
= $dbh->prepare(
- 'SELECT userid FROM profiles WHERE realname LIKE "%:%" AND is_enabled = 1 AND NOT nickname'
+ "SELECT userid FROM profiles WHERE realname LIKE '%:%' AND is_enabled = 1 AND nickname = ''"
);
$sth->execute();
while (my ($user_id) = $sth->fetchrow_array) {
abstraction modules. This code needs to be migrated back to the database
abstraction modules so their extension can be disposed of.
+**[COMPLETED]**
+
# Sensible, Default Logging Configuration
Bugzilla::Logging controls how the application logs. It has support for
environment:
- 'BMO_inbound_proxies=*'
- BMO_db_driver=pg
- - BMO_db_host=bugzilla6.db
+ - BMO_db_host=bugzilla6.pgsql9
- BMO_db_name=bugs
- BMO_db_pass=bugs
- BMO_db_user=bugs
- BMO_urlbase=AUTOMATIC
- BUGZILLA_ALLOW_INSECURE_HTTP=1
- BZ_ANSWERS_FILE=/app/conf/checksetup_answers.txt
- - BZ_QA_ANSWERS_FILE=/app/.circleci/checksetup_answers.txt
- - BZ_QA_CONF_FILE=/app/.circleci/selenium_test.conf
+ - BZ_QA_ANSWERS_FILE=/app/.github/checksetup_answers.txt
+ - BZ_QA_CONF_FILE=/app/.github/selenium_test.conf
- BZ_QA_CONFIG=1
- LOCALCONFIG_ENV=1
- LOG4PERL_CONFIG_FILE=log4perl-test.conf
- TWD_HOST=selenium
- TWD_PORT=4444
depends_on:
- - bugzilla6.db
+ - bugzilla6.pgsql9
- memcached
- selenium
- bugzilla6.db:
+ bugzilla6.pgsql9:
image: postgres:9.0
tmpfs:
- /tmp
- /run
environment:
- 'BMO_inbound_proxies=*'
- - BMO_db_host=bugzilla6.db
+ - BMO_db_host=bugzilla6.mysql8
- BMO_db_name=bugs
- BMO_db_pass=bugs
- BMO_db_user=bugs
- TWD_HOST=selenium
- TWD_PORT=4444
depends_on:
- - bugzilla6.db
+ - bugzilla6.mysql8
- memcached
- selenium
- bugzilla6.db:
+ bugzilla6.mysql8:
image: mysql:8
tmpfs:
- /tmp
- /run
environment: &bz_env
- 'BMO_inbound_proxies=*'
- - BMO_db_host=bugzilla6.db
+ - BMO_db_host=bugzilla6.mysql8
- BMO_db_name=bugs
- BMO_db_pass=bugs
- BMO_db_user=bugs
- MOJO_LISTEN=http://*:8000
- PORT=8000
depends_on:
- - bugzilla6.db
+ - bugzilla6.mysql8
- memcached
# - tinyproxy
ports:
# environment: *bz_env
# restart: always
# depends_on:
-# - bugzilla6.db
+# - bugzilla6.mysql8
# - memcached
# bugzilla6.feed:
# environment: *bz_env
# restart: always
# depends_on:
-# - bugzilla6.db
+# - bugzilla6.mysql8
# - memcached
# bugzilla6.pushd:
# environment: *bz_env
# restart: always
# depends_on:
-# - bugzilla6.db
+# - bugzilla6.mysql8
# - memcached
- bugzilla6.db:
+ bugzilla6.mysql8:
build:
context: .
dockerfile: Dockerfile.mysql8
export CI=""
export CIRCLE_SHA1=""
export CIRCLE_BUILD_URL=""
-$DOCKER compose -f docker-compose.test.yml build
+DOCKER_COMPOSE_FILE=docker-compose.test.yml
+if [ "$1" == "pg" ]; then
+ DOCKER_COMPOSE_FILE=docker-compose.test-pg.yml
+fi
+$DOCKER compose -f $DOCKER_COMPOSE_FILE build
if [ $? == 0 ]; then
- $DOCKER compose -f docker-compose.test.yml run --rm --name bugzilla6.test bugzilla6.test test_bmo -q -f t/bmo/*.t
- $DOCKER compose -f docker-compose.test.yml stop
+ $DOCKER compose -f $DOCKER_COMPOSE_FILE run --rm --name bugzilla6.test bugzilla6.test test_bmo -q -f t/bmo/*.t
+ $DOCKER compose -f $DOCKER_COMPOSE_FILE down
else
echo "docker compose build failed."
fi
$args->{'schema'}->{'flagtype_comments'} = {
FIELDS => [
type_id => {
- TYPE => 'SMALLINT(6)',
+ TYPE => 'INT2',
NOTNULL => 1,
REFERENCES => {TABLE => 'flagtypes', COLUMN => 'id', DELETE => 'CASCADE'}
},
# Store the largest last key so we can start from there in the next session
my $type_full = $type . "_last_id";
TRACE("UPDATING " . uc($type_full) . ": $last_id");
- Bugzilla->dbh->do("REPLACE INTO phabbugz (name, value) VALUES (?, ?)",
- undef, $type_full, $last_id);
+ if (Bugzilla->dbh->selectrow_array("SELECT 1 FROM phabbugz WHERE name = ?",
+ undef, $type_full)) {
+ Bugzilla->dbh->do("UPDATE phabbugz SET value = ? WHERE name = ?",
+ undef, $last_id, $type_full);
+ }
+ else {
+ Bugzilla->dbh->do("INSERT INTO phabbugz (name, value) VALUES (?, ?)",
+ undef, $type_full, $last_id);
+ }
}
sub get_group_members {
if ($oauth_id && $oauth_secret) {
print "creating phabricator oauth2 client...\n";
- $dbh->do(
- 'REPLACE INTO oauth2_client (client_id, description, secret) VALUES (?, \'Phabricator\', ?)',
- undef, $oauth_id, $oauth_secret
- );
+ if ($dbh->selectrow_array("SELECT 1 FROM oauth2_client WHERE client_id = ?",
+ undef, $oauth_id)) {
+ $dbh->do(
+ "UPDATE oauth2_client SET description = 'Phabricator', secret = ? WHERE client_id = ?",
+ undef, $oauth_secret, $oauth_id
+ );
+ }
+ else {
+ $dbh->do(
+ 'INSERT INTO oauth2_client (client_id, description, secret) VALUES (?, \'Phabricator\', ?)',
+ undef, $oauth_id, $oauth_secret
+ );
+ }
my $client_data
= $dbh->selectrow_hashref('SELECT * FROM oauth2_client WHERE client_id = ?',
my $scope_id = $dbh->selectrow_array(
'SELECT id FROM oauth2_scope WHERE name = \'user:read\'', undef);
- $dbh->do('REPLACE INTO oauth2_client_scope (client_id, scope_id) VALUES (?, ?)',
- undef, $client_data->{id}, $scope_id);
+ if ($dbh->selectrow_array("SELECT 1 FROM oauth2_client_scope WHERE client_id = ?",
+ undef, $client_data->{id})) {
+ $dbh->do("UPDATE oauth2_client_scope SET scope_id = ? WHERE client_id = ?",
+ undef, $scope_id, $client_data->{id}
+ );
+ }
+ else {
+ $dbh->do('INSERT INTO oauth2_client_scope (client_id, scope_id) VALUES (?, ?)',
+ undef, $client_data->{id}, $scope_id
+ );
+ }
}
print "installation and configuration complete!\n";