@@ -148,10 +148,11 @@ func TestGetPanelImageParams_UnmarshalVariables(t *testing.T) {
148148
149149func TestBuildRenderURL (t * testing.T ) {
150150 tests := []struct {
151- name string
152- baseURL string
153- args GetPanelImageParams
154- contains []string
151+ name string
152+ baseURL string
153+ args GetPanelImageParams
154+ contains []string
155+ notContains []string
155156 }{
156157 {
157158 name : "Basic dashboard render" ,
@@ -168,7 +169,7 @@ func TestBuildRenderURL(t *testing.T) {
168169 },
169170 },
170171 {
171- name : "Panel render with custom dimensions" ,
172+ name : "Panel render with custom dimensions uses d-solo path " ,
172173 baseURL : "http://localhost:3000" ,
173174 args : GetPanelImageParams {
174175 DashboardUID : "abc123" ,
@@ -177,11 +178,15 @@ func TestBuildRenderURL(t *testing.T) {
177178 Height : intPtr (600 ),
178179 },
179180 contains : []string {
180- "http://localhost:3000/render/d/abc123" ,
181- "viewPanel =5" ,
181+ "http://localhost:3000/render/d-solo /abc123" ,
182+ "panelId =5" ,
182183 "width=800" ,
183184 "height=600" ,
184185 },
186+ notContains : []string {
187+ "/render/d/abc123" ,
188+ "viewPanel=" ,
189+ },
185190 },
186191 {
187192 name : "With time range" ,
@@ -269,6 +274,9 @@ func TestBuildRenderURL(t *testing.T) {
269274 for _ , expected := range tt .contains {
270275 assert .Contains (t , result , expected )
271276 }
277+ for _ , unexpected := range tt .notContains {
278+ assert .NotContains (t , result , unexpected )
279+ }
272280 })
273281 }
274282}
@@ -328,9 +336,10 @@ func TestGetPanelImage(t *testing.T) {
328336 }
329337 })
330338
331- t .Run ("Panel image with specific panel ID" , func (t * testing.T ) {
339+ t .Run ("Panel image with specific panel ID uses d-solo path and panelId param " , func (t * testing.T ) {
332340 server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
333- assert .Equal (t , "5" , r .URL .Query ().Get ("viewPanel" ))
341+ assert .Contains (t , r .URL .Path , "/render/d-solo/test-dash" )
342+ assert .Equal (t , "5" , r .URL .Query ().Get ("panelId" ))
334343
335344 w .Header ().Set ("Content-Type" , "image/png" )
336345 w .WriteHeader (http .StatusOK )
0 commit comments