Skip to content

Commit

Permalink
App-inspect test-failure scenario fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
VatsalJagani committed Mar 13, 2024
1 parent 0ebef3d commit fb714ab
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 3 deletions.
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions tests/test_app_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
from main import main



SPLUNKBASE_USERNAME_FOR_TEST = os.environ["SPLUNKBASE_USERNAME_FOR_TEST"]
SPLUNKBASE_PASSWORD_FOR_TEST = os.environ["SPLUNKBASE_PASSWORD_FOR_TEST"]


class TestAppInspect(unittest.TestCase):

def test_app_inspect_failure_integration(self):
with setup_action_yml("repo_1_regular_build", app_dir="my_app_1", is_app_inspect_check="true", splunkbase_username=SPLUNKBASE_USERNAME_FOR_TEST, splunkbase_password=SPLUNKBASE_PASSWORD_FOR_TEST):
with setup_action_yml("app_inspect_fail", app_dir=".", is_app_inspect_check="true", splunkbase_username=SPLUNKBASE_USERNAME_FOR_TEST, splunkbase_password=SPLUNKBASE_PASSWORD_FOR_TEST):
with pytest.raises(SystemExit) as pytest_wrapped_e:
main()
assert pytest_wrapped_e.type == SystemExit
Expand Down
78 changes: 78 additions & 0 deletions tests/test_app_repos/app_inspect_fail/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Correct App Inspect Test App


OVERVIEW
--------
Test app for splunk-app-action.

* Author - Vatsal Jagani
* Creates Index - False
* Compatible with:
* Splunk Enterprise version: 9.0.x, 8.2.x
* OS: Platform Independent
* Browser: Does not have UI.


## What's inside the App

* No of Custom Inputs: **1**



TOPOLOGY AND SETTING UP SPLUNK ENVIRONMENT
------------------------------------------
There are two ways to setup this app:
1. Standalone Mode:
* Install the `App Inspect Pass`.
2. Distributed Mode:
* The Add-on is required on the Search Head for field extraction. Input configuration is not required on the Search Head.
* Install the `App Inspect Pass` on the universal forwarders on Windows and configure it. (You can do it from the Deployment Server.)
* Install the Add-on on a heavy forwarder if forwarders are sending data to Heavy Forwarder, otherwise install it on Indexers for data parsing. Input configuration is not required for both indexers and heavy forwarders.


DEPENDENCIES
------------------------------------------------------------
* There are no external dependencies for this Add-on.


INSTALLATION
------------------------------------------------------------
* From the Splunk Home page, click the gear icon next to Apps.
* Click `Browse more apps`.
* Search for `App Inspect Pass`.
* Click `Install`.
* If prompted, restart Splunk.


DATA COLLECTION & CONFIGURATION
------------------------------------------------------------



UNINSTALL ADD-ON
-------------
1. SSH to the Splunk instance.
2. Navigate to apps ($SPLUNK_HOME/etc/apps).
3. Remove the `app_inspect_pass` folder from the `apps` directory.
4. Restart Splunk.


RELEASE NOTES
-------------
None


OPEN SOURCE COMPONENTS AND LICENSES
------------------------------
* N/A


CONTRIBUTORS
------------
* Vatsal Jagani



SUPPORT
-------
* None
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Write-Output "This is generating dummy data.";
exit
16 changes: 16 additions & 0 deletions tests/test_app_repos/app_inspect_fail/default/app.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[install]
is_configured = 0
state = enabled
build = 1

[launcher]
author = Vatsal Jagani
version = 1.1.0
description = App Inspect Fail

[ui]
is_visible = 0
label = App Inspect Fail

[package]
id = app_inspect_fail
6 changes: 6 additions & 0 deletions tests/test_app_repos/app_inspect_fail/default/inputs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Dummy Log Input
[powershell://generate_dummy_logs]
script = . "$SplunkHome\etc\apps\app_inspect_pass\bin\generate_dummy_logs.ps1"
schedule = 0 */6 * * *
sourcetype = DummyLog
disabled = 1
6 changes: 6 additions & 0 deletions tests/test_app_repos/app_inspect_fail/default/props.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
###### DummyLog ######

[DummyLog]
SHOULD_LINEMERGE = false
DATETIME_CONFIG = NONE
TRUNCATE = 9999
8 changes: 8 additions & 0 deletions tests/test_app_repos/app_inspect_fail/metadata/default.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

[]
access = read : [ * ], write : [ admin ]
export = system

[views]
access = read : [ * ], write : [ admin ]
export = none
1 change: 0 additions & 1 deletion tests/test_app_repos/app_inspect_pass/default/app.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# this add-on is powered by splunk Add-on builder
[install]
is_configured = 0
state = enabled
Expand Down

0 comments on commit fb714ab

Please sign in to comment.