summaryrefslogtreecommitdiff
path: root/tests.branching
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-08-29 11:48:50 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-08-30 10:34:53 +0000
commit2beadc4d94bd77e1794832c758b6174ff1ada0a6 (patch)
treea4edb67ad6a7158517ad230acedba12cb9b27bac /tests.branching
parentb0096f15bb3624207b1df71b22070b4780b03658 (diff)
downloadmorph-2beadc4d94bd77e1794832c758b6174ff1ada0a6.tar.gz
edit: Unset defaults before writing
This also amends the test suite. The git apply command to alter the stratum proved inflexible when anything changed, so it has been replaced by a small in-line python script.
Diffstat (limited to 'tests.branching')
-rwxr-xr-xtests.branching/add-then-edit.script29
-rw-r--r--tests.branching/edit-updates-stratum-build-depends.stdout25
-rw-r--r--tests.branching/edit-updates-stratum.stdout19
-rw-r--r--tests.branching/petrify.stdout8
4 files changed, 25 insertions, 56 deletions
diff --git a/tests.branching/add-then-edit.script b/tests.branching/add-then-edit.script
index d6a2270f..5cd6e842 100755
--- a/tests.branching/add-then-edit.script
+++ b/tests.branching/add-then-edit.script
@@ -32,23 +32,18 @@ cd test:morphs
## Sub-optimally, to alter the stratum, you have to `morph edit` it first
"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum
-git apply <<'EOF'
-diff --git a/hello-stratum.morph b/hello-stratum.morph
-index 3b7be17..c79a9af 100644
---- a/hello-stratum.morph
-+++ b/hello-stratum.morph
-@@ -5,6 +5,10 @@
- name: hello
- ref: master
- repo: test:hello
-+- build-depends: []
-+ name: goodbye
-+ ref: master
-+ repo: test:goodbye
- description: ''
- kind: stratum
- name: hello-stratum
-EOF
+python -c 'import yaml
+with open("hello-stratum.morph", "r") as f:
+ stratum = yaml.load(f)
+stratum["chunks"].append({
+ "build-depends": [],
+ "name": "goodbye",
+ "ref": "master",
+ "repo": "test:goodbye",
+})
+with open("hello-stratum.morph", "w") as f:
+ yaml.dump(stratum, f)
+'
"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye
diff --git a/tests.branching/edit-updates-stratum-build-depends.stdout b/tests.branching/edit-updates-stratum-build-depends.stdout
index 5b556e3c..00b303bd 100644
--- a/tests.branching/edit-updates-stratum-build-depends.stdout
+++ b/tests.branching/edit-updates-stratum-build-depends.stdout
@@ -1,30 +1,21 @@
diff --git a/hello-stratum.morph b/hello-stratum.morph
-index 73ed482..b3f27b4 100644
+index 73ed482..3731d63 100644
--- a/hello-stratum.morph
+++ b/hello-stratum.morph
-@@ -1,8 +1,11 @@
-+build-depends: []
- chunks:
+@@ -2,7 +2,7 @@ chunks:
- build-depends: []
build-mode: test
-+ morph: hello
name: hello
- ref: master
+ ref: newbranch
repo: test:hello
-+description: ''
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index 721473c..a4c5640 100644
+index 721473c..94c1837 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -1,9 +1,12 @@
- arch: x86_64
-+configuration-extensions: []
-+description: ''
-+disk-size: 1G
- kind: system
+@@ -3,9 +3,8 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
@@ -33,11 +24,13 @@ index 721473c..a4c5640 100644
repo: test:morphs
- morph: xyzzy-stratum
ref: master
+ repo: test:morphs
+-system-kind: rootfs-tarball
diff --git a/xyzzy-stratum.morph b/xyzzy-stratum.morph
-index e302037..71e7651 100644
+index e302037..97f7208 100644
--- a/xyzzy-stratum.morph
+++ b/xyzzy-stratum.morph
-@@ -1,11 +1,13 @@
+@@ -1,11 +1,11 @@
build-depends:
- morph: hello-stratum
- ref: master
@@ -45,11 +38,9 @@ index e302037..71e7651 100644
repo: test:morphs
chunks:
- build-depends: []
-+ morph: hello
name: hello
- ref: master
+ ref: newbranch
repo: test:hello
-+description: ''
kind: stratum
name: xyzzy-stratum
diff --git a/tests.branching/edit-updates-stratum.stdout b/tests.branching/edit-updates-stratum.stdout
index f6a1587c..e84dbe09 100644
--- a/tests.branching/edit-updates-stratum.stdout
+++ b/tests.branching/edit-updates-stratum.stdout
@@ -1,34 +1,25 @@
diff --git a/hello-stratum.morph b/hello-stratum.morph
-index 73ed482..b3f27b4 100644
+index 73ed482..3731d63 100644
--- a/hello-stratum.morph
+++ b/hello-stratum.morph
-@@ -1,8 +1,11 @@
-+build-depends: []
- chunks:
+@@ -2,7 +2,7 @@ chunks:
- build-depends: []
build-mode: test
-+ morph: hello
name: hello
- ref: master
+ ref: newbranch
repo: test:hello
-+description: ''
kind: stratum
name: hello-stratum
diff --git a/hello-system.morph b/hello-system.morph
-index b0fed3b..b1417ce 100644
+index b0fed3b..801a955 100644
--- a/hello-system.morph
+++ b/hello-system.morph
-@@ -1,8 +1,11 @@
- arch: x86_64
-+configuration-extensions: []
-+description: ''
-+disk-size: 1G
- kind: system
+@@ -3,6 +3,5 @@ kind: system
name: hello-system
strata:
- morph: hello-stratum
- ref: master
+ ref: newbranch
repo: test:morphs
- system-kind: rootfs-tarball
+-system-kind: rootfs-tarball
diff --git a/tests.branching/petrify.stdout b/tests.branching/petrify.stdout
index e41c2f02..213c6879 100644
--- a/tests.branching/petrify.stdout
+++ b/tests.branching/petrify.stdout
@@ -1,39 +1,31 @@
Petrified:
-build-depends: []
chunks:
- build-depends: []
build-mode: test
- morph: hello
name: hello
ref: 6c7ddb7a9c0c5bf4ee02a8de030f0892a399c6bb
repo: test:hello
unpetrify-ref: master
- build-depends: []
build-mode: test
- morph: goodbye
name: goodbye
ref: d34c96a9f07c2efd1faabc3b44f77c25580a276e
repo: test:goodbye
unpetrify-ref: test/petrify
-description: ''
kind: stratum
name: hello-stratum
Unpetrified:
-build-depends: []
chunks:
- build-depends: []
build-mode: test
- morph: hello
name: hello
ref: master
repo: test:hello
- build-depends: []
build-mode: test
- morph: goodbye
name: goodbye
ref: test/petrify
repo: test:goodbye
-description: ''
kind: stratum
name: hello-stratum