* CDN: Initial poc support for serving assets over a CDN
* Minor fix
* added build path and test
* fix lint error
* Added edition to cdn path
* Move master builds to a separate path
* Added error handling for the url parsing, changed setting name, and added docs
* Updated sample.ini
* Some property renames
* updated
* Minor update to html
* index template improvements
* Update docs/sources/administration/configuration.md
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
* Update docs/sources/administration/configuration.md
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
* Added ContentDeliveryPrefix to Licence service
* updated docs
* Updated test mock
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
(cherry picked from commit c04bc805b5)
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
This commit is contained in:
co-authored by
Torkel Ödegaard
parent
5bb9731a84
commit
64c13cd46b
@@ -2,6 +2,7 @@ package setting
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -389,3 +390,35 @@ func TestAuthDurationSettings(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, maxLifetimeDurationTest, cfg.LoginMaxLifetime)
|
||||
}
|
||||
|
||||
func TestGetCDNPath(t *testing.T) {
|
||||
var err error
|
||||
cfg := NewCfg()
|
||||
cfg.BuildVersion = "v7.5.0-11124"
|
||||
cfg.CDNRootURL, err = url.Parse("http://cdn.grafana.com")
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, "http://cdn.grafana.com/grafana-oss/v7.5.0-11124", cfg.GetContentDeliveryURL("grafana-oss"))
|
||||
require.Equal(t, "http://cdn.grafana.com/grafana/v7.5.0-11124", cfg.GetContentDeliveryURL("grafana"))
|
||||
}
|
||||
|
||||
func TestGetCDNPathWithPreReleaseVersionAndSubPath(t *testing.T) {
|
||||
var err error
|
||||
cfg := NewCfg()
|
||||
cfg.BuildVersion = "v7.5.0-11124pre"
|
||||
cfg.CDNRootURL, err = url.Parse("http://cdn.grafana.com/sub")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "http://cdn.grafana.com/sub/grafana-oss/pre-releases/v7.5.0-11124pre", cfg.GetContentDeliveryURL("grafana-oss"))
|
||||
require.Equal(t, "http://cdn.grafana.com/sub/grafana/pre-releases/v7.5.0-11124pre", cfg.GetContentDeliveryURL("grafana"))
|
||||
}
|
||||
|
||||
// Adding a case for this in case we switch to proper semver version strings
|
||||
func TestGetCDNPathWithAlphaVersion(t *testing.T) {
|
||||
var err error
|
||||
cfg := NewCfg()
|
||||
cfg.BuildVersion = "v7.5.0-alpha.11124"
|
||||
cfg.CDNRootURL, err = url.Parse("http://cdn.grafana.com")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "http://cdn.grafana.com/grafana-oss/pre-releases/v7.5.0-alpha.11124", cfg.GetContentDeliveryURL("grafana-oss"))
|
||||
require.Equal(t, "http://cdn.grafana.com/grafana/pre-releases/v7.5.0-alpha.11124", cfg.GetContentDeliveryURL("grafana"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user