mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Lint develop branch
This commit is contained in:
parent
6ac3f4d0b4
commit
a659c3be50
@ -32,9 +32,8 @@ In order to have the returner apply to all minions:
|
|||||||
ext_job_cache: elasticsearch
|
ext_job_cache: elasticsearch
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
# Import Python libs
|
# Import Python libs
|
||||||
|
from __future__ import absolute_import
|
||||||
from datetime import tzinfo, datetime, timedelta
|
from datetime import tzinfo, datetime, timedelta
|
||||||
import uuid
|
import uuid
|
||||||
import logging
|
import logging
|
||||||
@ -51,6 +50,7 @@ log = logging.getLogger(__name__)
|
|||||||
def __virtual__():
|
def __virtual__():
|
||||||
return __virtualname__
|
return __virtualname__
|
||||||
|
|
||||||
|
|
||||||
def _ensure_index(index):
|
def _ensure_index(index):
|
||||||
index_exists = __salt__['elasticsearch.index_exists'](index)
|
index_exists = __salt__['elasticsearch.index_exists'](index)
|
||||||
if not index_exists:
|
if not index_exists:
|
||||||
@ -70,7 +70,6 @@ def _ensure_index(index):
|
|||||||
__salt__['elasticsearch.alias_create']('{0}-v1'.format(index), index)
|
__salt__['elasticsearch.alias_create']('{0}-v1'.format(index), index)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def returner(ret):
|
def returner(ret):
|
||||||
'''
|
'''
|
||||||
Process the return from Salt
|
Process the return from Salt
|
||||||
|
30
tests/unit/modules/k8s_test.py
Executable file → Normal file
30
tests/unit/modules/k8s_test.py
Executable file → Normal file
@ -1,21 +1,26 @@
|
|||||||
# Import pytohn libs
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import absolute_import
|
'''
|
||||||
# Import Salt Testing libs
|
Unit Tests for the k8s execution module.
|
||||||
from salttesting import skipIf, TestCase
|
'''
|
||||||
from salttesting.helpers import ensure_in_syspath, skip_if_binaries_missing
|
|
||||||
ensure_in_syspath('../../')
|
|
||||||
# from unittest import TestCase
|
|
||||||
|
|
||||||
# Import Salt execution module to test
|
# Import Python libs
|
||||||
# from salt.modules import k8s
|
from __future__ import absolute_import
|
||||||
# FIXME
|
|
||||||
import salt.modules.k8s as k8s
|
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
|
# Import Salt Testing libs
|
||||||
|
from salttesting import TestCase
|
||||||
|
from salttesting.helpers import ensure_in_syspath, skip_if_binaries_missing
|
||||||
|
|
||||||
|
ensure_in_syspath('../../')
|
||||||
|
|
||||||
|
# Import Salt libs
|
||||||
|
import salt.modules.k8s as k8s
|
||||||
|
|
||||||
|
|
||||||
TestCase.maxDiff = None
|
TestCase.maxDiff = None
|
||||||
|
|
||||||
|
|
||||||
@ -294,7 +299,7 @@ spec:
|
|||||||
|
|
||||||
|
|
||||||
@skip_if_binaries_missing(['kubectl'])
|
@skip_if_binaries_missing(['kubectl'])
|
||||||
class TestK8SLimitrange(TestCase):
|
class TestK8SLimitRange(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
hash = hashlib.sha1()
|
hash = hashlib.sha1()
|
||||||
@ -391,6 +396,7 @@ spec:
|
|||||||
b = kubectl_out.get("metadata", {}).get("name", "b")
|
b = kubectl_out.get("metadata", {}).get("name", "b")
|
||||||
self.assertEqual(a, b)
|
self.assertEqual(a, b)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from integration import run_tests
|
from integration import run_tests
|
||||||
run_tests(TestK8SNamespace,
|
run_tests(TestK8SNamespace,
|
||||||
|
Loading…
Reference in New Issue
Block a user