Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNeNB-0007Mj-Qv for pgsql-jdbc@arkaria.postgresql.org; Thu, 24 Oct 2019 14:45:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNeN9-0006Kf-Ts for pgsql-jdbc@arkaria.postgresql.org; Thu, 24 Oct 2019 14:45:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNeN9-0006KX-Lr for pgsql-jdbc@lists.postgresql.org; Thu, 24 Oct 2019 14:45:55 +0000 Received: from out-24.smtp.github.com ([192.30.252.207]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNeN6-0001rz-Cf for pgsql-jdbc@lists.postgresql.org; Thu, 24 Oct 2019 14:45:54 +0000 Received: from github-lowworker-ca5950c.va3-iad.github.net (github-lowworker-ca5950c.va3-iad.github.net [10.48.17.57]) by smtp.github.com (Postfix) with ESMTP id 292596A0145 for ; Thu, 24 Oct 2019 07:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1571928350; bh=Mzh8x/ZFNBWeJYj3uQrJka5IR6Dog3cCvD2VXM6M9pU=; h=Date:From:To:Subject:From; b=D2+iu9TGli/ep6qPfnMjJT3Hd4OhwhgalbHabJ5CfTQvQap22Js70pid5jRDITyPv gsXtQFJI3vW1dH2thW5nSATbUTOIYHlsB1PAKL99yVkM1G/qHI97OoHwl2BYZdxsNY EtsrG24aOwbs6D7INjuM9I/rH2g+XAuj/Yc0eqjg= Date: Thu, 24 Oct 2019 07:45:50 -0700 From: Sehrope Sarkuni To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] ad7345: Clean up some tests and fix IsValidTest race condi... Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: ad734574726eb0decf5178071c87a1b513e484f2 https://github.com/pgjdbc/pgjdbc/commit/ad734574726eb0decf5178071c87a1b513e484f2 Author: Sehrope Sarkuni Date: 2019-10-24 (Thu, 24 Oct 2019) Changed paths: M pgjdbc/src/test/java/org/postgresql/test/TestUtil.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java M pgjdbc/src/test/java/org/postgresql/test/jdbc4/IsValidTest.java Log Message: ----------- Clean up some tests and fix IsValidTest race condition (#1581) * test: Add some helpers to TestUtil Adds some helpers to TestUtil to deal with boiler plate of executinga query and disgarding the results, fetching the backend process id, terminating a backend process, and fetching the current transaction state. * test: Clean up IsValidTest Cleans up IsValidTest and removes a race condition when checking whether terminated connections are marked as invalid. Also splits out the transaction state test into three separate ones to better identify what's being tested. * test: Change CopyTest to use TestUtil backend pid helpers This also changes the connection termination to use a non-privileged connection. * test: Change ConnectionPoolTest to use backend pid TestUtil helpers This also changes the pg_terminate_backend(...) call to use a non-privileged connection as a regular user can terminate their own connection. * fix: Use super user to terminate backend processes in tests Older versions of the server (<=9.1) restrict calling pg_terminate_backend(...) to super users so always use that in test helper.