package jira

import (
	"log"
	"testing"

	"github.com/spf13/viper"
)

func TestSendToO11Y(t *testing.T) {
	setUpConfig()
	names, urls, err := SearchCorrelatedIssueInO11Y(SearchParams{TenantId: "1311265642040528896", ClusterId: "1379661944636714101"})
	if err != nil {
		log.Println(err)
	}
	if len(names) > 0 {
		log.Println(names[0], urls[0])
	} else {
		log.Println("no issues captured")
	}
}

func setUpConfig() {
	viper.Set("scope", "prod")
	viper.SetConfigName("conf")         // name of config file (without extension)
	viper.SetConfigType("yaml")         // REQUIRED if the config file does not have the extension in the name
	viper.AddConfigPath("../../config") // optionally look for config in the working directory
	viper.ReadInConfig()
	log.Println(viper.GetString("jira_token.tcoc_token"))
}
