Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add script to start memcached and a test to make sure it's running

Signed-off-by: Carlos Gabaldon <cgabaldon@cox.net>
  • Loading branch information...
commit 44bc6a3f8d25cd808889637641021b16e9cc1ec5 1 parent 5d7626c
Christian Carey authored Carlos Gabaldon committed
View
8 README
@@ -25,6 +25,14 @@ Getting started with your Dolomite foundation
- Activate your dolomite foundation environment with the command:
source dolomite-env/bin/activate
+
+- Start local memcached daemon:
+
+ start-memcached
+
+- Test local memcached daemon:
+
+ test-memcached
- When done, you can deactivate the dolomite foundation environment:
View
6 build-all
@@ -5,6 +5,8 @@ function die()
exit 1
}
+rm -rf tmp
+
./build.py memcached
if [ ! $? -eq 0 ]; then
die "Encountered error building memcached. Check messages and try again."
@@ -15,6 +17,8 @@ if [ ! $? -eq 0 ]; then
die "Encountered error building memcachedb. Check messages and try again."
fi
-cd tools
+cp -r tools/* tmp/tar/dolomite-env/bin
+
+cd tmp/tar
tar cvvfz ../tools-ubuntu-8.10.tgz .
View
15 build.py
@@ -4,12 +4,14 @@
import warnings
warnings.filterwarnings('ignore','.*apt API not stable yet.*')
-
import apt
+TOOLS_BIN_FOLDER = 'tmp/tar/dolomite-env/bin'
+
def create_dir(name):
if not os.path.exists(name):
- os.mkdir(name)
+ #os.mkdir(name)
+ os.makedirs(name)
def dependenciesMet(packages):
met = True
@@ -24,9 +26,9 @@ def dependenciesMet(packages):
def copy_built_files(files, build_dir):
if type(files) is list:
for f in files:
- shutil.copy('tmp/%s/%s' % (build_dir, f), 'tools/dolomite-env/bin')
+ shutil.copy('tmp/%s/%s' % (build_dir, f), TOOLS_BIN_FOLDER)
else:
- shutil.copy('tmp/%s/%s' % (build_dir, files), 'tools/dolomite-env/bin')
+ shutil.copy('tmp/%s/%s' % (build_dir, files), TOOLS_BIN_FOLDER)
def usage():
print("Usage: %s component_name" % sys.argv[0])
@@ -52,10 +54,7 @@ def main():
config = get_config(component)
- create_dir('tmp')
- create_dir('tools')
- create_dir('tools/dolomite-env')
- create_dir('tools/dolomite-env/bin')
+ create_dir(TOOLS_BIN_FOLDER)
os.chdir('tmp')
View
3  tools/start-memcached
@@ -0,0 +1,3 @@
+#!/bin/bash
+memcached -d -m 1024 -l 127.0.0.1 -p 11211
+
View
33 tools/test-memcached
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+import memcache
+import unittest
+
+class MemcachedTest(unittest.TestCase):
+
+ def setUp(self):
+ self.mc = memcache.Client(['127.0.0.1:11211'], debug=0)
+
+ def testSetGet(self):
+ self.mc.set("test_write", "my test value")
+ self.failUnless(self.mc.get("test_write") == "my test value", "did not read correct value")
+
+ def testSetDelete(self):
+ self.mc.set("test_write", "my test value to delete")
+ self.mc.delete("test_write")
+ self.assert_(self.mc.get("test_write") is None)
+
+def run_tests():
+ results = unittest.TestResult()
+ test_suite = suite = unittest.TestLoader().loadTestsFromTestCase(MemcachedTest)
+
+ test_suite.run(results)
+
+ if results.wasSuccessful:
+ print("Memcached test passed... your foundation is solid!")
+ else:
+ print("Failed!")
+ print(results)
+
+
+if __name__ == "__main__":
+ run_tests()

0 comments on commit 44bc6a3

Please sign in to comment.
Something went wrong with that request. Please try again.