mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 08:50:42 +02:00
internal/databroker: fix wrong server version init (#1125)
This commit is contained in:
parent
99785cbb5b
commit
1d82be2c0e
2 changed files with 7 additions and 6 deletions
|
@ -48,7 +48,7 @@ func TestServer_initVersion(t *testing.T) {
|
|||
assert.NotNil(t, r)
|
||||
var sv databroker.ServerVersion
|
||||
assert.NoError(t, ptypes.UnmarshalAny(r.GetData(), &sv))
|
||||
assert.Equal(t, srv.version, sv.Version)
|
||||
assert.Equal(t, srvVersion, sv.Version)
|
||||
})
|
||||
t.Run("init version twice should get the same version", func(t *testing.T) {
|
||||
srv := newServer(cfg)
|
||||
|
@ -56,17 +56,18 @@ func TestServer_initVersion(t *testing.T) {
|
|||
db := srv.getDB(recordTypeServerVersion)
|
||||
r := db.Get(ctx, serverVersionKey)
|
||||
assert.Nil(t, r)
|
||||
srvVersion := uuid.New().String()
|
||||
srv.version = srvVersion
|
||||
|
||||
srv.initVersion()
|
||||
assert.Equal(t, srvVersion, srv.version)
|
||||
srvVersion := srv.version
|
||||
|
||||
r = db.Get(ctx, serverVersionKey)
|
||||
assert.NotNil(t, r)
|
||||
var sv databroker.ServerVersion
|
||||
assert.NoError(t, ptypes.UnmarshalAny(r.GetData(), &sv))
|
||||
assert.Equal(t, srv.version, sv.Version)
|
||||
assert.Equal(t, srvVersion, sv.Version)
|
||||
|
||||
// re-init version should get the same value as above
|
||||
srv.version = "foo"
|
||||
srv.initVersion()
|
||||
assert.Equal(t, srvVersion, srv.version)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue