Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5095)

Issue 54600043: -

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 3 months ago by lazypower
Modified:
10 years, 2 months ago
Reviewers:
mp+202112, benjamin.saller, Marco Ceppi, peter.petrakis
Visibility:
Public.

Description

Adds integration tests for unit deploy, db relationship with mysql, and cache relationship with memcached https://code.launchpad.net/~lazypower/charms/precise/mediawiki/tests/+merge/202112 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6

Patch Set 2 : - #

Total comments: 1

Patch Set 3 : - #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -117 lines) Patch
A [revision details] View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M hooks/config-changed View 1 chunk +13 lines, -9 lines 0 comments Download
A tests/00_setup.sh View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
A tests/100-deploy View 1 2 1 chunk +83 lines, -0 lines 0 comments Download
M tests/100_deploy.test View 1 2 1 chunk +0 lines, -62 lines 0 comments Download
D tests/get-unit-info View 1 2 1 chunk +0 lines, -46 lines 0 comments Download

Messages

Total messages: 7
lazypower
Please take a look.
10 years, 3 months ago (2014-01-20 16:26:10 UTC) #1
benjamin.saller
Thanks for this. I had a number of suggestions. Also if those .moved files are ...
10 years, 3 months ago (2014-01-21 17:11:44 UTC) #2
lazypower
Please take a look.
10 years, 3 months ago (2014-01-22 17:24:17 UTC) #3
benjamin.saller
LGTM Thanks for the improvements, this version looked much cleaner than the last.
10 years, 3 months ago (2014-01-22 19:20:03 UTC) #4
Marco Ceppi
See below, LGTM otherwise. https://codereview.appspot.com/54600043/diff/20001/tests/00_setup.sh File tests/00_setup.sh (right): https://codereview.appspot.com/54600043/diff/20001/tests/00_setup.sh#newcode3 tests/00_setup.sh:3: sudo apt-get install install amulet ...
10 years, 2 months ago (2014-02-04 21:25:14 UTC) #5
lazypower
Please take a look.
10 years, 2 months ago (2014-02-14 21:22:07 UTC) #6
peter.petrakis
10 years, 2 months ago (2014-02-14 22:01:20 UTC) #7
On 2014/02/14 21:22:07, lazypower wrote:
> Please take a look.

New to this service, so old school for now:



=== modified file 'hooks/config-changed'
--- hooks/config-changed	2012-06-28 00:01:31 +0000
+++ hooks/config-changed	2014-01-20 05:33:44 +0000
@@ -59,12 +59,16 @@

...
+
+#added to prevent failure when no db relationship exists
+if [ -f /etc/mediawiki/LocalSettings.php ]; then
+    for admin in $admins ; do
+        user=`echo $admin | cut -d: -f1`
+        pass=`echo $admin | cut -d: -f2`


If "admins" is empty this will happily work, the pipe to cut will not error. In
this case I would
exit 1 with meaningful juju-log message.

+        output=`php createAndPromote.php --conf
/etc/mediawiki/LocalSettings.php $user $pass`
+        if [ ! "$output" = "account exists." ] ; then
+            echo $output
+            exit 1
+        fi
+    done
+fi
 


=== added file 'tests/100-deploy'
--- tests/100-deploy	1970-01-01 00:00:00 +0000
+++ tests/100-deploy	2014-02-14 21:21:50 +0000
@@ -0,0 +1,83 @@
+#!/usr/bin/env python3
+import amulet
+from splinter import Browser
+
+seconds = 900
+
+d = amulet.Deployment()
+
+#Setup the charms, and relationships

Inconsistent comment pattern, should have a space between hash and string

+# Perform the setup for the deployment.
+try:
+    d.setup(seconds)
+    #pings every deployed unit
+    d.sentry.wait(seconds)

Same pattern. Also uppercase or lower case for sentence start, either is fine
just be consistent.


=== added file 'tests/100-deploy'
--- tests/100-deploy	1970-01-01 00:00:00 +0000
+++ tests/100-deploy	2014-02-14 21:21:50 +0000
...
+# Validate that the database server was set for the configuration of MediaWiki
+#Set search term for comparison, and cache the flag in the configuration file
+output, code = mw_unit.run("cat /etc/mediawiki/LocalSettings.php \
+        | grep wgDBserver | awk '{printf $3}'")

You can do that entirely in awk, something like awk '/wgDBserver/ && printf $3' 
FILE. If you're so inclined.

...
+memcached_relation = d.sentry.unit['memcached/0'].relation(
+    'cache', 'mediawiki:cache')
+output, code = mw_unit.run("cat /etc/mediawiki/memcached_settings.php \
+    | grep wgMemCachedServers | tr -d \'array\(\)\; | awk '{printf $3}'")

Just call grep or not, arguably a style call, keeping the file to be worked on
as the first argument.

=== removed file 'tests/100_deploy.test'
--- tests/100_deploy.test	2012-01-31 01:27:17 +0000
+++ tests/100_deploy.test	1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-if [ -z "`which wget`" ] ; then
-    echo SKIP: need wget to run test.
-    exit 100
-fi

I know this was removed but...
backticks are typically used in in bash shell, $() in bash scripts. Tough habit
to break.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b