Skip to content

Instantly share code, notes, and snippets.

@dpgoetz
dpgoetz / gist:3919635
Created October 19, 2012 17:56
unit test
diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py
index 4eeed3a..6efc98f 100644
--- a/test/unit/proxy/test_server.py
+++ b/test/unit/proxy/test_server.py
@@ -46,7 +46,7 @@ from swift.common.exceptions import ChunkReadTimeout
from swift.common.constraints import MAX_META_NAME_LENGTH, \
MAX_META_VALUE_LENGTH, MAX_META_COUNT, MAX_META_OVERALL_SIZE, \
MAX_FILE_SIZE, MAX_ACCOUNT_NAME_LENGTH, MAX_CONTAINER_NAME_LENGTH
-from swift.common.utils import mkdirs, normalize_timestamp, NullLogger
+from swift.common.utils import mkdirs, normalize_timestamp, NullLogger, public
@dpgoetz
dpgoetz / gist:3919748
Created October 19, 2012 18:15
unit test
diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py
index 4eeed3a..3ee2edf 100644
--- a/test/unit/proxy/test_server.py
+++ b/test/unit/proxy/test_server.py
@@ -46,7 +46,7 @@ from swift.common.exceptions import ChunkReadTimeout
from swift.common.constraints import MAX_META_NAME_LENGTH, \
MAX_META_VALUE_LENGTH, MAX_META_COUNT, MAX_META_OVERALL_SIZE, \
MAX_FILE_SIZE, MAX_ACCOUNT_NAME_LENGTH, MAX_CONTAINER_NAME_LENGTH
-from swift.common.utils import mkdirs, normalize_timestamp, NullLogger
+from swift.common.utils import mkdirs, normalize_timestamp, NullLogger, public
@dpgoetz
dpgoetz / gist:4019083
Created November 5, 2012 17:51
cors diff
diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py
index 582d007..887471e 100644
--- a/swift/proxy/controllers/base.py
+++ b/swift/proxy/controllers/base.py
@@ -39,7 +39,7 @@ from swift.common.exceptions import ChunkReadTimeout, ConnectionTimeout
from swift.common.http import is_informational, is_success, is_redirection, \
is_server_error, HTTP_OK, HTTP_PARTIAL_CONTENT, HTTP_MULTIPLE_CHOICES, \
HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVICE_UNAVAILABLE, \
- HTTP_INSUFFICIENT_STORAGE
+ HTTP_INSUFFICIENT_STORAGE, HTTP_UNAUTHORIZED
@dpgoetz
dpgoetz / gist:4019111
Created November 5, 2012 17:52
cors diff
diff --git a/swift/proxy/controllers/base.py b/swift/proxy/controllers/base.py
index 582d007..4234493 100644
--- a/swift/proxy/controllers/base.py
+++ b/swift/proxy/controllers/base.py
@@ -39,7 +39,7 @@ from swift.common.exceptions import ChunkReadTimeout, ConnectionTimeout
from swift.common.http import is_informational, is_success, is_redirection, \
is_server_error, HTTP_OK, HTTP_PARTIAL_CONTENT, HTTP_MULTIPLE_CHOICES, \
HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVICE_UNAVAILABLE, \
- HTTP_INSUFFICIENT_STORAGE
+ HTTP_INSUFFICIENT_STORAGE, HTTP_UNAUTHORIZED
@dpgoetz
dpgoetz / gist:4046852
Created November 9, 2012 16:59
account OPTIONS call
This allows people to find out if an account is valid in swift (used to always just 401)
dfg@ubuntu:~/swift/swift$ curl -i http://127.0.0.1:8080/v1/AUTH_dfg -X OPTIONS
HTTP/1.1 200 OK
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 0
Date: Fri, 09 Nov 2012 16:55:42 GMT
dfg@ubuntu:~/swift/swift$ curl -i http://127.0.0.1:8080/v1/asdf -X OPTIONS
HTTP/1.1 401 Unauthorized
#!/usr/bin/python
import httplib
import json
import sys
if len(sys.argv) < 3:
print 'example: slob_test.py /v1/AUTH_dfg AUTH_tk81f3f8d0c2f34f706c48c'
sys.exit()
reset_conn = False
from eventlet import sleep
from time import time
import random
from swift.common.wsgi import WSGIContext
from swift.common.swob import Request
from swift.common.utils import FileLikeIter, json
def slow_iter(req, wsgi_iter, data_to_read, sleep_time):
wsgi_iter = iter(wsgi_iter)
dfg@saio4:~/go/src/github.com/openstack/swift/go/bench$ hummingbird dbench
Usage: [configuration file]
The configuration file should look something like:
[dbench]
address = http://localhost:6010/
concurrency = 15
object_size = 131072
num_objects = 5000
num_gets = 30000
do_replicates = false
dfg@saio4:~/hbird-tests$ cat slo-read.py
import httplib
import time
for i in range(30):
c = httplib.HTTPConnection("127.0.0.1:8080")
c.request(
"GET",
"/v1/AUTH_dfg/hat/hugeman",
'',
dfg@saio:~/go/src/github.com/troubling/hummingbird$ time swift-init main restart
Signal proxy-server pid: 8158 signal: 15
Signal container-server pid: 8159 signal: 15
Signal container-server pid: 8160 signal: 15
Signal container-server pid: 8161 signal: 15
Signal container-server pid: 8162 signal: 15
Signal account-server pid: 8163 signal: 15
Signal account-server pid: 8164 signal: 15
Signal account-server pid: 8165 signal: 15
Signal account-server pid: 8166 signal: 15