From e30b0c73cb6805689c58b3ed9d5dd091218e2df3 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Wed, 22 Jan 2014 14:48:29 +0000 Subject: yarns: Add regression test for cache-key clash --- scripts/edit-morph | 18 ++++++++++++++++++ yarns/implementations.yarn | 15 +++++++++++++++ yarns/regression.yarn | 19 +++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/scripts/edit-morph b/scripts/edit-morph index acb33b7e..2970cc6e 100755 --- a/scripts/edit-morph +++ b/scripts/edit-morph @@ -227,4 +227,22 @@ class EditMorph(cliapp.Application): with open(file_path, "w") as f: yaml.dump(d, f) + def cmd_set_stratum_match_rules(self, (file_path, match_rules)): + '''Set a stratum's match rules. + + Usage: FILE_PATH MATCH_RULES_YAML + + This sets the stratum's "products" field, which is used to + determine which chunk artifacts go into which stratum artifacts + the stratum produces. + + The match rules must be a string that yaml can parse. + + ''' + with open(file_path, "r") as f: + d = yaml.load(f) + d['products'] = yaml.load(match_rules) + with open(file_path, "w") as f: + yaml.dump(d, f) + EditMorph().run() diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index 7e9b7275..b4d8e7ce 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -809,3 +809,18 @@ Altering morphologies in their source repositories "$DATADIR/gits/morphs/$MATCH_1.morph" "$MATCH_3" "$MATCH_2" run_in "$DATADIR/gits/morphs" git add "$MATCH_1.morph" run_in "$DATADIR/gits/morphs" git commit -m "Make $MATCH_1 only use $MATCH_2" + + IMPLEMENTS GIVEN stratum (\S+) has match rules: (.*) + cd "$DATADIR/gits/morphs" + "$SRCDIR/scripts/edit-morph" set-stratum-match-rules \ + "$MATCH_1.morph" "$MATCH_2" + git add "$MATCH_1.morph" + git commit -m "Make $MATCH_1 match $MATCH_2" + +Altering morphologies in the workspace +-------------------------------------- + + IMPLEMENTS GIVEN stratum (\S+) in system branch (\S+) has match rules: (.*) + cd "$DATADIR/workspace/$MATCH_2/test:morphs" + "$SRCDIR/scripts/edit-morph" set-stratum-match-rules \ + "$MATCH_1.morph" "$MATCH_3" diff --git a/yarns/regression.yarn b/yarns/regression.yarn index 49c663ec..71431ff7 100644 --- a/yarns/regression.yarn +++ b/yarns/regression.yarn @@ -46,6 +46,25 @@ area, hence their results cannot be trusted. AND the user attempts to build the system bootstrap-system in branch master THEN the build error message includes the string "No non-bootstrap chunks found" +When we started allowing multiple artifacts, a long-standing bug in +cache-key computation was discovered, it didn't include artifact names, +which would cause a collision if a morphology changed which artifacts +from a source it depended on, but not the number of artifacts from that +source it depended on. + + SCENARIO changing the artifacts a system uses + GIVEN a workspace + AND a git server + AND system test-system uses test-stratum-runtime from test-stratum + AND stratum test-stratum has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|locale)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|misc)]}] + WHEN the user checks out the system branch called master + GIVEN a cluster called test-cluster for deploying only the test-system system as type tar in system branch master + WHEN the user builds the system test-system in branch master + GIVEN stratum test-stratum in system branch master has match rules: [{artifact: test-stratum-runtime, include: [.*-(bins|libs|misc)]}, {artifact: test-stratum-devel, include: [.*-(devel|doc|locale)]}] + WHEN the user builds the system test-system in branch master + AND the user deploys the cluster test-cluster in branch master with options system.location="$DATADIR/test.tar" + THEN tarball test.tar contains baserock/test-chunk-misc.meta + Implementations --------------- -- cgit v1.2.1