-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into readable-version-line
- Loading branch information
Showing
38 changed files
with
919 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package cephosdconfig | ||
|
||
import ( | ||
"github.com/creasty/defaults" | ||
"github.com/pkg/errors" | ||
"gopkg.in/yaml.v3" | ||
|
||
"github.com/runityru/cephctl/models" | ||
) | ||
|
||
func New(in []byte) (models.CephOSDConfig, error) { | ||
spec := models.CephOSDConfig{} | ||
if err := defaults.Set(&spec); err != nil { | ||
return models.CephOSDConfig{}, errors.Wrap(err, "error setting default values") | ||
} | ||
|
||
if err := yaml.Unmarshal(in, &spec); err != nil { | ||
return models.CephOSDConfig{}, errors.Wrap(err, "error decoding spec file") | ||
} | ||
|
||
return spec, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package cephosdconfig | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/runityru/cephctl/models" | ||
) | ||
|
||
func TestNewValidConfig(t *testing.T) { | ||
r := require.New(t) | ||
|
||
data, err := os.ReadFile("testdata/full.json") | ||
r.NoError(err) | ||
|
||
cfg, err := New(data) | ||
r.NoError(err) | ||
r.Equal(models.CephOSDConfig{ | ||
AllowCrimson: true, | ||
NearfullRatio: 0.75, | ||
BackfillfullRatio: 0.8, | ||
FullRatio: 0.85, | ||
RequireMinCompatClient: "squid", | ||
}, cfg) | ||
} | ||
|
||
func TestNewEmptyConfig(t *testing.T) { | ||
r := require.New(t) | ||
|
||
data, err := os.ReadFile("testdata/empty.json") | ||
r.NoError(err) | ||
|
||
cfg, err := New(data) | ||
r.NoError(err) | ||
r.Equal(models.CephOSDConfig{ | ||
AllowCrimson: false, | ||
NearfullRatio: 0.85, | ||
BackfillfullRatio: 0.9, | ||
FullRatio: 0.95, | ||
RequireMinCompatClient: "reef", | ||
}, cfg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"allow_crimson": true, | ||
"nearfull_ratio": 0.75, | ||
"backfillfull_ratio": 0.8, | ||
"full_ratio": 0.85, | ||
"require_min_compat_client": "squid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
ceph/config/spec/testdata/sample_NewFromDescriptionJSON.json
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
ceph/config/spec/testdata/sample_NewFromDescriptionMulti.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
kind: CephConfig | ||
spec: | ||
global: | ||
rbd_cache: "true" | ||
osd: | ||
rocksdb_perf: "true" | ||
--- | ||
kind: CephOSDConfig | ||
spec: | ||
allow_crimson: true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.