From patchwork Sun Feb 23 18:52:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Mangano-Tarumi?= X-Patchwork-Id: 1522 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 2F4F81738DC18 for ; Sun, 23 Feb 2020 18:53:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID=1, DKIM_SIGNED=0.1,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001 autolearn=ham autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.9.1] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Sun, 23 Feb 2020 18:53:00 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id F25CB194FFD8E7; Sun, 23 Feb 2020 18:52:58 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id B46EC194FFD8E0; Sun, 23 Feb 2020 18:52:58 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg0.fr header.i=@mg0.fr header.b=SPURtQYe Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id A8A6829D19; Sun, 23 Feb 2020 18:52:58 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg0.fr header.i=@mg0.fr header.b=SPURtQYe Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id CCFA329D19 for ; Sun, 23 Feb 2020 18:52:38 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by luna.archlinux.org (Postfix) with ESMTPS for ; Sun, 23 Feb 2020 18:52:38 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id BEAFD194FFD8D3 for ; Sun, 23 Feb 2020 18:52:36 +0000 (UTC) Received: from tsubame.mg0.fr (tsubame.mg0.fr [IPv6:2001:41d0:401:3100::402b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Sun, 23 Feb 2020 18:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mg0.fr; s=tsubame; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date:Sender :Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wrVMd7GNBCpkr442DkKlA1DXrEeJM3bC7Pn+g4kKCS8=; b=SPURtQYeAgJjB0U94Z3Bj5aQoJ GymsJCFHa3N9LbHpIZ9dZv4eF+N+xNujnMO1GaP6jqBerCbJZD7l7Ox+UPX2/9AZSIaiHS49c+wNL ZcI9YsuzxW0xzreVZ+si8AlnXvImdXAAGbPJXoR/7DwnX9JJ8Zzf0wr6eRyLhWwvEA10=; Received: from fmang by tsubame.mg0.fr with local (Exim 4.93) (envelope-from ) id 1j5wMm-004K4b-9K for aur-dev@archlinux.org; Sun, 23 Feb 2020 19:52:36 +0100 Date: Sun, 23 Feb 2020 19:52:36 +0100 From: =?utf-8?b?RnLDqWTDqXJpYw==?= Mangano-Tarumi To: aur-dev@archlinux.org Subject: [PATCH 2/2] Disable Alembic support on test databases Message-ID: <20200223185236.GA1030467@tsubame.mg0.fr> MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: aur-dev@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Arch User Repository \(AUR\) Development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: aur-dev-bounces@archlinux.org Sender: "aur-dev" --- aurweb/initdb.py | 12 +++++++++--- test/setup.sh | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/aurweb/initdb.py b/aurweb/initdb.py index c02fb961..91777f7e 100644 --- a/aurweb/initdb.py +++ b/aurweb/initdb.py @@ -36,14 +36,17 @@ def run(args): # Ensure Alembic is fine before we do the real work, in order not to fail at # the last step and leave the database in an inconsistent state. The # configuration is loaded lazily, so we query it to force its loading. - alembic_config = alembic.config.Config('alembic.ini') - alembic_config.get_main_option('script_location') + if args.use_alembic: + alembic_config = alembic.config.Config('alembic.ini') + alembic_config.get_main_option('script_location') engine = sqlalchemy.create_engine(aurweb.db.get_sqlalchemy_url(), echo=(args.verbose >= 1)) aurweb.schema.metadata.create_all(engine) feed_initial_data(engine.connect()) - alembic.command.stamp(alembic_config, 'head') + + if args.use_alembic: + alembic.command.stamp(alembic_config, 'head') if __name__ == '__main__': @@ -52,5 +55,8 @@ if __name__ == '__main__': description='Initialize the aurweb database.') parser.add_argument('-v', '--verbose', action='count', default=0, help='increase verbosity') + parser.add_argument('--no-alembic', + help='disable Alembic migrations support', + dest='use_alembic', action='store_false') args = parser.parse_args() run(args) diff --git a/test/setup.sh b/test/setup.sh index 12f6edcc..cad5cd66 100644 --- a/test/setup.sh +++ b/test/setup.sh @@ -110,7 +110,7 @@ SSH_TTY=/dev/pts/0 export SSH_CLIENT SSH_CONNECTION SSH_TTY # Initialize the test database. -python -m aurweb.initdb +python -m aurweb.initdb --no-alembic echo "INSERT INTO Users (ID, UserName, Passwd, Email, LangPreference, AccountTypeID) VALUES (1, 'user', '!', 'user@localhost', 'en', 1);" | sqlite3 aur.db echo "INSERT INTO Users (ID, UserName, Passwd, Email, LangPreference, AccountTypeID) VALUES (2, 'tu', '!', 'tu@localhost', 'en', 2);" | sqlite3 aur.db