@@ -3,6 +3,7 @@ package splunk
33import (
44 "fmt"
55 "net/http"
6+ "net/url"
67 "reflect"
78 "strconv"
89 "testing"
@@ -69,6 +70,19 @@ resource "splunk_saved_searches" "test" {
6970}
7071`
7172
73+ const savedSearchesNamespacedImport = `
74+ resource "splunk_saved_searches" "test" {
75+ name = "Test Namespaced Import"
76+ search = "index=main"
77+ cron_schedule = "*/5 * * * *"
78+ acl {
79+ owner = "admin"
80+ sharing = "app"
81+ app = "search"
82+ }
83+ }
84+ `
85+
7286const newSavedSearchesBracket = `
7387resource "splunk_saved_searches" "test" {
7488 name = "[Test New Alert]"
@@ -776,6 +790,38 @@ func TestAccSplunkSavedSearches(t *testing.T) {
776790 })
777791}
778792
793+ func TestAccSplunkSavedSearchesNamespacedImport (t * testing.T ) {
794+ resourceName := "splunk_saved_searches.test"
795+ importID := "/servicesNS/admin/search/saved/searches/" + url .PathEscape ("Test Namespaced Import" )
796+
797+ resource .Test (t , resource.TestCase {
798+ PreCheck : func () {
799+ testAccPreCheck (t )
800+ },
801+ Providers : testAccProviders ,
802+ CheckDestroy : testAccSplunkSavedSearchesDestroyResources ,
803+ Steps : []resource.TestStep {
804+ {
805+ Config : savedSearchesNamespacedImport ,
806+ Check : resource .ComposeTestCheckFunc (
807+ resource .TestCheckResourceAttr (resourceName , "name" , "Test Namespaced Import" ),
808+ resource .TestCheckResourceAttr (resourceName , "search" , "index=main" ),
809+ resource .TestCheckResourceAttr (resourceName , "cron_schedule" , "*/5 * * * *" ),
810+ resource .TestCheckResourceAttr (resourceName , "acl.0.owner" , "admin" ),
811+ resource .TestCheckResourceAttr (resourceName , "acl.0.app" , "search" ),
812+ resource .TestCheckResourceAttr (resourceName , "acl.0.sharing" , "app" ),
813+ ),
814+ },
815+ {
816+ ResourceName : resourceName ,
817+ ImportState : true ,
818+ ImportStateId : importID ,
819+ ImportStateVerify : true ,
820+ },
821+ },
822+ })
823+ }
824+
779825// TestAccSplunkSavedSearchesEmailIncludeLinksZero verifies that setting
780826// action_email_include_results_link and action_email_include_view_link to 0
781827// sends them to the API and they are returned on read (and appear in savedsearches.conf).
0 commit comments