MCPcopy
hub / github.com/devtron-labs/devtron / getBaseServerDetails

Function getBaseServerDetails

tests/e2e/BasicTestConf.go:66–95  ·  view source on GitHub ↗

this function will read testEnvironmentConfig.json file and get baseServerUrl, username and pwd depending on environment

()

Source from the content-addressed store, hash-verified

64
65//this function will read testEnvironmentConfig.json file and get baseServerUrl, username and pwd depending on environment
66func getBaseServerDetails() (string, string, string) {
67 var envToTest, baseServerUrl, loginUserName, loginUserPwd string
68
69 //STEP 1 : Open the file
70 testDataJsonFile, err := os.Open("../testdata/testEnvironmentConfig.json")
71 if (nil != err) {
72 util.GetLogger().Errorw("Unable to open the file. Error occurred !!", "err", err)
73 }
74 util.GetLogger().Infow("Opened testEnvironmentConfig.json file successfully !")
75
76 defer testDataJsonFile.Close()
77
78 // STEP 2 : Now get required values depending on environment requested.
79 byteValue, _ := ioutil.ReadAll(testDataJsonFile)
80 var envConf EnvironmentConf
81 json.Unmarshal([]byte(byteValue), &envConf)
82
83 envToTest = envConf.TestEnv
84
85 for i := 0; i < len(envConf.EnvList); i++ {
86 if(envToTest == envConf.EnvList[i].EnvironmentName) {
87 baseServerUrl = envConf.EnvList[i].BaseServerUrl
88 loginUserName = envConf.EnvList[i].LogInUserName
89 loginUserPwd = envConf.EnvList[i].LogInUserPwd
90 }
91 }
92 util.GetLogger().Infow("BaseServerUrl: ", "URL:", baseServerUrl)
93 return baseServerUrl, loginUserName, loginUserPwd
94
95}
96
97//make the api call to the requested url based on http method requested
98func makeApiCall(apiUrl string, method string, body string, setCookie bool) (*resty.Response, error) {

Callers 2

getRestyClientFunction · 0.85
getAuthTokenFunction · 0.85

Calls 2

GetLoggerFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…