"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "storage/remote/write_test.go" between
prometheus-2.19.1.tar.gz and prometheus-2.19.2.tar.gz

About: Prometheus is a monitoring system, alerting toolkit and time series database.

write_test.go  (prometheus-2.19.1):write_test.go  (prometheus-2.19.2)
skipping to change at line 23 skipping to change at line 23
package remote package remote
import ( import (
"io/ioutil" "io/ioutil"
"net/url" "net/url"
"os" "os"
"testing" "testing"
"time" "time"
"github.com/prometheus/client_golang/prometheus"
common_config "github.com/prometheus/common/config" common_config "github.com/prometheus/common/config"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
"github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/pkg/relabel" "github.com/prometheus/prometheus/pkg/relabel"
"github.com/prometheus/prometheus/util/testutil" "github.com/prometheus/prometheus/util/testutil"
) )
var cfg = config.RemoteWriteConfig{ var cfg = config.RemoteWriteConfig{
Name: "dev", Name: "dev",
skipping to change at line 157 skipping to change at line 158
conf.RemoteWriteConfigs[0].Name = "dev-2" conf.RemoteWriteConfigs[0].Name = "dev-2"
testutil.Ok(t, s.ApplyConfig(conf)) testutil.Ok(t, s.ApplyConfig(conf))
hash, err = toHash(cfg) hash, err = toHash(cfg)
testutil.Ok(t, err) testutil.Ok(t, err)
testutil.Equals(t, s.queues[hash].client().Name(), conf.RemoteWriteConfig s[0].Name) testutil.Equals(t, s.queues[hash].client().Name(), conf.RemoteWriteConfig s[0].Name)
err = s.Close() err = s.Close()
testutil.Ok(t, err) testutil.Ok(t, err)
} }
func TestUpdateWithRegisterer(t *testing.T) {
dir, err := ioutil.TempDir("", "TestRestartWithRegisterer")
testutil.Ok(t, err)
defer os.RemoveAll(dir)
s := NewWriteStorage(nil, prometheus.NewRegistry(), dir, time.Millisecond
)
c1 := &config.RemoteWriteConfig{
Name: "named",
URL: &common_config.URL{
URL: &url.URL{
Scheme: "http",
Host: "localhost",
},
},
QueueConfig: config.DefaultQueueConfig,
}
c2 := &config.RemoteWriteConfig{
URL: &common_config.URL{
URL: &url.URL{
Scheme: "http",
Host: "localhost",
},
},
QueueConfig: config.DefaultQueueConfig,
}
conf := &config.Config{
GlobalConfig: config.DefaultGlobalConfig,
RemoteWriteConfigs: []*config.RemoteWriteConfig{c1, c2},
}
testutil.Ok(t, s.ApplyConfig(conf))
c1.QueueConfig.MaxShards = 10
c2.QueueConfig.MaxShards = 10
testutil.Ok(t, s.ApplyConfig(conf))
for _, queue := range s.queues {
testutil.Equals(t, 10, queue.cfg.MaxShards)
}
err = s.Close()
testutil.Ok(t, err)
}
func TestWriteStorageLifecycle(t *testing.T) { func TestWriteStorageLifecycle(t *testing.T) {
dir, err := ioutil.TempDir("", "TestWriteStorageLifecycle") dir, err := ioutil.TempDir("", "TestWriteStorageLifecycle")
testutil.Ok(t, err) testutil.Ok(t, err)
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
s := NewWriteStorage(nil, nil, dir, defaultFlushDeadline) s := NewWriteStorage(nil, nil, dir, defaultFlushDeadline)
conf := &config.Config{ conf := &config.Config{
GlobalConfig: config.DefaultGlobalConfig, GlobalConfig: config.DefaultGlobalConfig,
RemoteWriteConfigs: []*config.RemoteWriteConfig{ RemoteWriteConfigs: []*config.RemoteWriteConfig{
&config.DefaultRemoteWriteConfig, &config.DefaultRemoteWriteConfig,
skipping to change at line 181 skipping to change at line 224
err = s.Close() err = s.Close()
testutil.Ok(t, err) testutil.Ok(t, err)
} }
func TestUpdateExternalLabels(t *testing.T) { func TestUpdateExternalLabels(t *testing.T) {
dir, err := ioutil.TempDir("", "TestUpdateExternalLabels") dir, err := ioutil.TempDir("", "TestUpdateExternalLabels")
testutil.Ok(t, err) testutil.Ok(t, err)
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
s := NewWriteStorage(nil, nil, dir, time.Second) s := NewWriteStorage(nil, prometheus.NewRegistry(), dir, time.Second)
externalLabels := labels.FromStrings("external", "true") externalLabels := labels.FromStrings("external", "true")
conf := &config.Config{ conf := &config.Config{
GlobalConfig: config.GlobalConfig{}, GlobalConfig: config.GlobalConfig{},
RemoteWriteConfigs: []*config.RemoteWriteConfig{ RemoteWriteConfigs: []*config.RemoteWriteConfig{
&cfg, &cfg,
}, },
} }
hash, err := toHash(conf.RemoteWriteConfigs[0]) hash, err := toHash(conf.RemoteWriteConfigs[0])
testutil.Ok(t, err) testutil.Ok(t, err)
 End of changes. 3 change blocks. 
1 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)