-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
246 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ Depends: @, | |
bzr, | ||
git, | ||
mercurial, | ||
subversion, | ||
lxd, | ||
python3-pep8, | ||
pyflakes, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: test-package | ||
version: 0.1 | ||
summary: svn integration test | ||
description: use svn | ||
confinement: strict | ||
|
||
parts: | ||
svn: | ||
plugin: make | ||
source: repo/ | ||
source-type: svn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: test-package | ||
version: 0.1 | ||
summary: svn integration test | ||
description: use svn | ||
confinement: strict | ||
|
||
parts: | ||
svn: | ||
plugin: make | ||
source: repo/ | ||
source-type: svn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- | ||
# | ||
# Copyright (C) 2016 Canonical Ltd | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
import subprocess | ||
import shutil | ||
|
||
from testtools.matchers import FileExists | ||
|
||
import integration_tests | ||
|
||
|
||
class SubversionSourceTestCase(integration_tests.TestCase): | ||
|
||
def setUp(self): | ||
super().setUp() | ||
if shutil.which('svn') is None: | ||
self.skipTest('svn is not installed') | ||
|
||
def _init_svn(self): | ||
subprocess.check_call( | ||
['svnadmin', 'create', 'repo'], stdout=subprocess.DEVNULL) | ||
|
||
def test_pull_svn_checkout(self): | ||
project_dir = self.copy_project_to_tmp('svn-pull') | ||
os.chdir(project_dir) | ||
|
||
self._init_svn() | ||
|
||
subprocess.check_call( | ||
['svn', 'checkout', 'file:///{}'.format(os.path.join(project_dir, 'repo')), 'local'], | ||
stdout=subprocess.DEVNULL) | ||
|
||
open(os.path.join('local', 'file'), 'w').close() | ||
subprocess.check_call( | ||
['svn', 'add', 'file'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['svn', 'commit', '-m', 'test'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call(['svn', 'update'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['rm', '-rf', 'local/'], stdout=subprocess.DEVNULL) | ||
|
||
part_src_path = os.path.join('parts', 'svn', 'src') | ||
self.run_snapcraft('pull', project_dir) | ||
revno = subprocess.check_output(['svnversion', part_src_path]).strip() | ||
universal_newlines=True | ||
self.assertEqual('1', revno) | ||
self.assertThat(os.path.join(part_src_path, 'file'), FileExists()) | ||
|
||
def test_pull_svn_update(self): | ||
project_dir = self.copy_project_to_tmp('svn-pull-update') | ||
os.chdir(project_dir) | ||
|
||
self._init_svn() | ||
|
||
subprocess.check_call( | ||
['svn', 'checkout', 'file:///{}'.format(os.path.join(project_dir, 'repo')), 'local'], | ||
stdout=subprocess.DEVNULL) | ||
|
||
open(os.path.join('local', 'file'), 'w').close() | ||
subprocess.check_call( | ||
['svn', 'add', 'file'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['svn', 'commit', '-m', 'test'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call(['svn', 'update'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['rm', '-rf', 'local/'], stdout=subprocess.DEVNULL) | ||
|
||
part_src_path = os.path.join('parts', 'svn', 'src') | ||
subprocess.check_call( | ||
['svn', 'checkout', 'file:///{}'.format(os.path.join(project_dir, 'repo')), part_src_path], | ||
stdout=subprocess.DEVNULL) | ||
|
||
subprocess.check_call( | ||
['svn', 'checkout', 'file:///{}'.format(os.path.join(project_dir, 'repo')), 'local'], | ||
stdout=subprocess.DEVNULL) | ||
open(os.path.join('local', 'filetwo'), 'w').close() | ||
subprocess.check_call( | ||
['svn', 'add', 'filetwo'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['svn', 'commit', '-m', 'testtwo'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call(['svn', 'update'], stdout=subprocess.DEVNULL, cwd='local/') | ||
subprocess.check_call( | ||
['rm', '-rf', 'local/'], stdout=subprocess.DEVNULL) | ||
|
||
self.run_snapcraft('pull', project_dir) | ||
revno = subprocess.check_output(['svnversion', part_src_path]).strip() | ||
universal_newlines=True | ||
self.assertEqual('2', revno) | ||
self.assertThat(os.path.join(part_src_path, 'file'), FileExists()) | ||
self.assertThat(os.path.join(part_src_path, 'filetwo'), FileExists()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters