summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 12:03:12 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 12:03:12 -0400
commitce675ba46b6745b2625fc21e03a8fbf50b2de78b (patch)
tree94ba561396aa798cd6826917d0d9e32687a1a895
parent0505f9adc409e54ec5b602310c66b2da4a14930c (diff)
downloadbuildstream-ce675ba46b6745b2625fc21e03a8fbf50b2de78b.tar.gz
tests/sources/ostree.py: Removed test and data.
This was testing nothing whatsoever about the behavior of the plugin but just running for the sake of running. Removing this does not effect the coverage report of the ostree.py plugin.
-rw-r--r--tests/sources/ostree.py144
-rwxr-xr-xtests/sources/ostree/generate-ostree.sh31
-rw-r--r--tests/sources/ostree/head/project.conf2
-rw-r--r--tests/sources/ostree/head/target.bst7
-rw-r--r--tests/sources/ostree/nothead/project.conf2
-rw-r--r--tests/sources/ostree/nothead/target.bst7
6 files changed, 0 insertions, 193 deletions
diff --git a/tests/sources/ostree.py b/tests/sources/ostree.py
deleted file mode 100644
index 1f3a57ec9..000000000
--- a/tests/sources/ostree.py
+++ /dev/null
@@ -1,144 +0,0 @@
-import os
-import pytest
-import tempfile
-import subprocess
-import re
-from contextlib import contextmanager
-
-import http
-import http.server
-import socketserver
-import threading
-
-from buildstream import SourceError
-from buildstream import utils
-
-# import our common fixture
-from .fixture import Setup
-
-DATA_DIR = os.path.join(
- os.path.dirname(os.path.realpath(__file__)),
- 'ostree',
-)
-
-
-class OSTreeSetup(Setup):
-
- def __init__(self, datafiles, tmpdir, bstfile=None):
-
- if not bstfile:
- bstfile = 'target.bst'
-
- super().__init__(datafiles, bstfile, tmpdir)
-
-
-def run_ostree_bash_script():
- # Run the generate-ostree.sh script
- return subprocess.call(
- ['%s/generate-ostree.sh' % (DATA_DIR,)],
- stderr=subprocess.PIPE)
-
-
-def run_ostree_cli(repo, cmd):
- if type(cmd) is not list:
- cmd = [cmd]
-
- arg = ['ostree', '--repo=%s' % (repo,)]
- arg.extend(cmd)
- process = subprocess.Popen(
- arg,
- stderr=subprocess.PIPE,
- stdout=subprocess.PIPE)
- out, err = process.communicate()
-
- return process.returncode, out, err
-
-
-###############################################################
-# Tests #
-###############################################################
-def test_ostree_shell_exe():
- # Run the generate-ostree.sh script
- # Does it run ok?
- ret = run_ostree_bash_script()
-
- assert(ret == 0)
-
-
-def test_ostree_shell_dir_exist(tmpdir):
- # tmp/repo and tmp/files directories should exist
-
- run_ostree_bash_script()
-
- assert(os.path.isdir("tmp/repo"))
- assert(os.path.isdir("tmp/files"))
-
-
-def test_ostree_shell_branches():
- # only 'my/branch' should exist
-
- run_ostree_bash_script()
- exit, out, err = run_ostree_cli("tmp/repo", "refs")
- assert(out.decode('unicode-escape').strip() == "my/branch")
-
- exit, out, err = run_ostree_cli("repofoo", "refs")
- assert(err.decode('unicode-escape') != '')
-
-
-def test_ostree_shell_commits():
- # only 2 commits
- global REF_HEAD, REF_NOTHEAD
-
- run_ostree_bash_script()
- exit, out, err = run_ostree_cli("tmp/repo", ["log", "my/branch"])
-
- reg = re.compile(r'commit ([a-z0-9]{64})')
- commits = [m.groups()[0] for m in reg.finditer(str(out))]
- assert(len(commits) == 2)
-
-
-@pytest.mark.datafiles(os.path.join(DATA_DIR, 'head'))
-def test_ostree_conf(tmpdir, datafiles):
-
- setup = OSTreeSetup(datafiles, tmpdir)
- assert(setup.source.get_kind() == 'ostree')
-
- print(setup.source.url)
-
- # Test other config settings
- assert(setup.source.url == 'http://127.0.0.1:8000/tmp/repo')
- assert(setup.source.tracking == 'my/branch')
- assert(setup.source.gpg_key is None)
-
-
-# XXX The following test cases are broken and should be revived, checkouts
-# and fetches actually work, but the scaffolding for this test case needs work.
-#
-
-# @pytest.mark.datafiles(os.path.join(DATA_DIR, 'head'))
-# def test_ostree_fetch(tmpdir, datafiles):
-# setup = OSTreeSetup(datafiles, tmpdir)
-# assert(setup.source.get_kind() == 'ostree')
-#
-# print("fetch cwd : {}".format(os.getcwd()))
-# # Make sure we preflight and fetch first, cant stage without fetching
-# setup.source.preflight()
-# setup.source.fetch()
-#
-# # Check to see if the directory contains basic OSTree directories
-# expected = ['objects', 'config', 'tmp', 'extensions', 'state', 'refs']
-# indir = os.listdir(setup.source.mirror)
-# assert(set(expected) <= set(indir))
-
-# @pytest.mark.datafiles(os.path.join(DATA_DIR, 'head'))
-# def test_ostree_stage(tmpdir, datafiles):
-# setup = OSTreeSetup(datafiles, tmpdir)
-# assert(setup.source.get_kind() == 'ostree')
-
- # Make sure we preflight and fetch first, cant stage without fetching
-# setup.source.preflight()
-# setup.source.fetch()
-
- # Stage the file and just check that it's there
-# stagedir = os.path.join(setup.context.builddir, 'repo')
-# setup.source.stage(stagedir)
diff --git a/tests/sources/ostree/generate-ostree.sh b/tests/sources/ostree/generate-ostree.sh
deleted file mode 100755
index bbfaecb37..000000000
--- a/tests/sources/ostree/generate-ostree.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-TMP_DIR=tmp
-
-REPO=`pwd`/$TMP_DIR/repo
-DATA_DIR=$TMP_DIR/files
-
-COMMIT_ARGS=--branch=my/branch --owner-uid=0 --owner-gid=0 --no-xattrs
-
-# Make sure this is only ran once
-if [ ! -d "$REPO" ]; then
- mkdir -p $REPO
- mkdir -p $DATA_DIR
-
- ostree --repo=$REPO init --mode=archive-z2
-
- cd $DATA_DIR
-
- # Do first commit
- # 3c11e7aed983ad03a2982c33f061908879033dadce4c21ce93243c118264ee0f
- echo "1" > foo
- ostree --repo=$REPO $COMMIT_ARGS commit --branch=my/branch --subject="Initial commit" --body="This is the first commit."
-
- # Second commit
- # 85a4d86655f56715aea16170a0599218f8f42a8efea4727deb101b1520325f7e
- rm foo
- echo "1" > bar
- ostree --repo=$REPO $COMMIT_ARGS commit --branch=my/branch --subject="Another commit" --body="Removing foo and adding bar"
-
- ostree --repo=$REPO summary -u
-fi
diff --git a/tests/sources/ostree/head/project.conf b/tests/sources/ostree/head/project.conf
deleted file mode 100644
index afa0f5475..000000000
--- a/tests/sources/ostree/head/project.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Basic project
-name: foo
diff --git a/tests/sources/ostree/head/target.bst b/tests/sources/ostree/head/target.bst
deleted file mode 100644
index 272c67774..000000000
--- a/tests/sources/ostree/head/target.bst
+++ /dev/null
@@ -1,7 +0,0 @@
-kind: pony
-description: This is the pony
-sources:
-- kind: ostree
- url: http://127.0.0.1:8000/tmp/repo
- ref: 85a4d86655f56715aea16170a0599218f8f42a8efea4727deb101b1520325f7e
- track: my/branch \ No newline at end of file
diff --git a/tests/sources/ostree/nothead/project.conf b/tests/sources/ostree/nothead/project.conf
deleted file mode 100644
index afa0f5475..000000000
--- a/tests/sources/ostree/nothead/project.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-# Basic project
-name: foo
diff --git a/tests/sources/ostree/nothead/target.bst b/tests/sources/ostree/nothead/target.bst
deleted file mode 100644
index 147617e2a..000000000
--- a/tests/sources/ostree/nothead/target.bst
+++ /dev/null
@@ -1,7 +0,0 @@
-kind: pony
-description: This is the pony
-sources:
-- kind: ostree
- url: 127.0.0.1:8000
- ref: 3c11e7aed983ad03a2982c33f061908879033dadce4c21ce93243c118264ee0f
- branch: my/branch \ No newline at end of file