Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Add file for vulcand backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a5huynh committed Feb 11, 2016
1 parent 1acafc0 commit dda4138
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/test_vulcand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: ahuynh
# @Date: 2016-02-11 14:28:02
# @Last Modified by: ahuynh
# @Last Modified time: 2016-02-11 14:49:02
import unittest

from sidekick import announce_services, find_matching_container, parse_args

from tests import MockEtcd


class TestVulcandBackend( unittest.TestCase ):

def setUp( self ):

self.args = parse_args([
'--name', 'test',
'--ip', 'localhost',
'--check-ip', '0.0.0.0',
'--vulcand'
])

self.etcd_client = MockEtcd()

self.container = {
'Image': 'image:latest',
'Ports': [{
'PrivatePort': 9200,
'IP': '0.0.0.0',
'Type': 'tcp',
'PublicPort': 9200 }, {
'PrivatePort': 9300,
'IP': '0.0.0.0',
'Type': 'tcp',
'PublicPort': 9300}],
'Created': 1427906382,
'Names': ['/test'],
'Status': 'Up 2 days'
}

def test_announce_services( self ):
""" Test `announce_services` functionality """
services = find_matching_container( [ self.container ], self.args )
announce_services( services.items(), 'test', self.etcd_client, 0, 0, True )

0 comments on commit dda4138

Please sign in to comment.