<commit_before>from ceilometer import sample
from ceilometer_publisher_zeromq import queue
from urlparse import SplitResult
import os
import sys
import zmq

def stub_sample():
    return sample.Sample(
        "stub_name",
        "gauge",
        "MB",
        "14",
        "larry-id",
        "larrys-project-id",
        "larrys-box-id",
        "antediluvian",
        {"redundant-data": "data"},
    )

def stub_expected():
    return {
        "name": "stub_name",
        "type": "gauge",
        "unit": "MB",
        "volume": "14",
        "user_id": "larry-id",
        "project_id": "larrys-project-id",
        "resource_id": "larrys-box-id",
        "timestamp": "antediluvian",
        "resource_metadata": {
            "redundant-data": "data"
        },
        "source": "openstack",
    }

def main(argv=None):
    #Setup connection
    context = zmq.Context()
    socket  = context.socket(zmq.REP)
    socket.bind("tcp://127.0.0.1:8282")
    #Use the publihser to publish a single message
    new_pid = os.fork()
    if new_pid == 0:
        queue.QueuePublisher(
            SplitResult(scheme = 'rabbitmq', netloc='', path='', query='', fragment='')
        ).publish_samples(None, [stub_sample()])
        os._exit(0)
    else:
        #Grab and check the message is as we expect
        a = socket.recv_json()
        socket.send("")
        a.pop('id', None)
        assert a == stub_expected()

if __name__ == '__main__':
    sys.exit(main())
<commit_msg>Correct url scheme + spelling in test_integration.py<commit_after>from ceilometer import sample
from ceilometer_publisher_zeromq import queue
from urlparse import SplitResult
import os
import sys
import zmq

def stub_sample():
    return sample.Sample(
        "stub_name",
        "gauge",
        "MB",
        "14",
        "larry-id",
        "larrys-project-id",
        "larrys-box-id",
        "antediluvian",
        {"redundant-data": "data"},
    )

def stub_expected():
    return {
        "name": "stub_name",
        "type": "gauge",
        "unit": "MB",
        "volume": "14",
        "user_id": "larry-id",
        "project_id": "larrys-project-id",
        "resource_id": "larrys-box-id",
        "timestamp": "antediluvian",
        "resource_metadata": {
            "redundant-data": "data"
        },
        "source": "openstack",
    }

def main(argv=None):
    #Setup connection
    context = zmq.Context()
    socket  = context.socket(zmq.REP)
    socket.bind("tcp://127.0.0.1:8282")
    #Use the publisher to publish a single message
    new_pid = os.fork()
    if new_pid == 0:
        queue.QueuePublisher(
            SplitResult(scheme = 'tcp', netloc='', path='', query='', fragment='')
        ).publish_samples(None, [stub_sample()])
        os._exit(0)
    else:
        #Grab and check the message is as we expect
        a = socket.recv_json()
        socket.send("")
        a.pop('id', None)
        assert a == stub_expected()

if __name__ == '__main__':
    sys.exit(main())

{'fraction_non_alphanumeric': 0.14933333333333335, 'fraction_numerical': 0.010666666666666666, 'mean_word_length': 2.247835497835498, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5245045', 'n_tokens_mistral': 1014, 'n_tokens_neox': 976, 'n_words': 225}