-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rsuplina <[email protected]>
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2024 Cloudera, Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
import os | ||
import logging | ||
import pytest | ||
|
||
from ansible_collections.cloudera.cluster.plugins.modules import cm_service | ||
from ansible_collections.cloudera.cluster.tests.unit import AnsibleExitJson, AnsibleFailJson | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
def test_pytest_cm_service(module_args): | ||
module_args( | ||
{ | ||
"username": os.getenv('CM_USERNAME'), | ||
"password": os.getenv('CM_PASSWORD'), | ||
"host": os.getenv('CM_HOST'), | ||
"port": "7180", | ||
"verify_tls": "no", | ||
"debug": "yes", | ||
"state": "started", | ||
"role" : [ "SERVICEMONITOR" , "HOSTMONITOR", "EVENTSERVER", "ALERTPUBLISHER" ] | ||
} | ||
) | ||
|
||
# with pytest.raises(AnsibleFailJson, match=r"boom") as e: | ||
with pytest.raises(AnsibleExitJson) as e: | ||
cm_service.main() | ||
|
||
# LOG.info(str(e.value)) | ||
LOG.info(str(e.value.cloudera_manager)) |