From 4164ea83900f0e373d8f15603ae00e7d781eea47 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Thu, 27 Apr 2023 15:54:29 -0400 Subject: [PATCH] Initial test of CircleCI environment variables --- .circleci/config.yml | 23 +++++++++++++++++++++++ system_test/e2e/auto_backup.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 system_test/e2e/auto_backup.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e1fb4e2..dbfdbec0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -170,6 +170,28 @@ jobs: RQLITED_PATH: /home/circleci/go/bin/rqlited resource_class: large + end_to_end_auto_backup: + docker: + - image: cimg/go:1.20.0 + steps: + - checkout + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + - run: sudo apt-get update + - run: sudo apt-get install python3 + - run: sudo apt install python3-pip + - run: python3 -m pip install requests boto3 + - run: go version + - run: go get -t -d -v ./... + - run: go install -tags osusergo,netgo,sqlite_omit_load_extension + -ldflags="-extldflags=-static" ./... + - run: + command: python3 system_test/e2e/auto_backup.py + environment: + RQLITED_PATH: /home/circleci/go/bin/rqlited + resource_class: large + workflows: version: 2 build_and_test: @@ -183,3 +205,4 @@ workflows: - end_to_end_multi_adv - end_to_end_joining - end_to_end_autoclustering + - end_to_end_auto_backup diff --git a/system_test/e2e/auto_backup.py b/system_test/e2e/auto_backup.py new file mode 100644 index 00000000..d1f92668 --- /dev/null +++ b/system_test/e2e/auto_backup.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# +# End-to-end testing using actual rqlited binary. +# +# To run a specific test, execute +# +# python system_test/full_system_test.py Class.test + +import os +import unittest + +from helpers import Node, deprovision_node + +RQLITED_PATH = os.environ['RQLITED_PATH'] + +class TestAutoBackupS3(unittest.TestCase): + '''Test that automatic backups to AWS S3 work''' + def test(self): + if os.environ['RQLITE_S3_ACCESS_KEY'] is not None and os.environ['RQLITE_S3_SECRET_KEY'] is not None: + print("Running test because environment variables are set") + else: + print("Skipping test because environment variables are not set") + return + + n0 = Node(RQLITED_PATH, '0') + n0.start() + n0.wait_until_leader() + deprovision_node(n0) + + +if __name__ == "__main__": + unittest.main(verbosity=2) \ No newline at end of file