Skip to content

Commit

Permalink
config/v3_5: stabilize
Browse files Browse the repository at this point in the history
  • Loading branch information
travier committed Oct 14, 2024
1 parent e98dd18 commit 3b0b89b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
10 changes: 5 additions & 5 deletions config/v3_5/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v3_5_experimental
package v3_5

import (
"github.com/coreos/ignition/v2/config/merge"
"github.com/coreos/ignition/v2/config/shared/errors"
"github.com/coreos/ignition/v2/config/util"
prev "github.com/coreos/ignition/v2/config/v3_4"
"github.com/coreos/ignition/v2/config/v3_5_experimental/translate"
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_5/translate"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/coreos/ignition/v2/config/validate"

"github.com/coreos/go-semver/semver"
Expand Down Expand Up @@ -58,8 +58,8 @@ func Parse(rawConfig []byte) (types.Config, report.Report, error) {
return config, rpt, nil
}

// ParseCompatibleVersion parses the raw config of version 3.5.0-experimental or
// lesser into a 3.5-exp types.Config struct and generates a report of any errors,
// ParseCompatibleVersion parses the raw config of version 3.5.0 or
// lesser into a 3.5 types.Config struct and generates a report of any errors,
// warnings, info, and deprecations it encountered
func ParseCompatibleVersion(raw []byte) (types.Config, report.Report, error) {
version, rpt, err := util.GetConfigVersion(raw)
Expand Down
20 changes: 12 additions & 8 deletions config/v3_5/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package v3_5_experimental
package v3_5

import (
"testing"

"github.com/coreos/ignition/v2/config/shared/errors"
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_5/types"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -83,6 +83,10 @@ func TestParse(t *testing.T) {
in: in{config: []byte(`{"ignition": {"version": "3.4.0"}}`)},
out: out{err: errors.ErrUnknownVersion},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0"}}`)},
out: out{config: types.Config{Ignition: types.Ignition{Version: types.MaxVersion.String()}}},
},
{
in: in{config: []byte(`{"ignition": {"version": "2.0.0-experimental"}}`)},
out: out{err: errors.ErrUnknownVersion},
Expand Down Expand Up @@ -129,7 +133,7 @@ func TestParse(t *testing.T) {
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0-experimental"}}`)},
out: out{config: types.Config{Ignition: types.Ignition{Version: types.MaxVersion.String()}}},
out: out{err: errors.ErrUnknownVersion},
},
{
in: in{config: []byte(`{"ignition": {"version": "2.0.0"},}`)},
Expand All @@ -148,7 +152,7 @@ func TestParse(t *testing.T) {
out: out{err: errors.ErrEmpty},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0-experimental"}, "storage": {"filesystems": [{"format": "ext4", "label": "zzzzzzzzzzzzzzzzzzzzzzzzzzz"}]}}`)},
in: in{config: []byte(`{"ignition": {"version": "3.5.0"}, "storage": {"filesystems": [{"format": "ext4", "label": "zzzzzzzzzzzzzzzzzzzzzzzzzzz"}]}}`)},
out: out{err: errors.ErrInvalid},
},
}
Expand Down Expand Up @@ -178,15 +182,15 @@ func TestParse(t *testing.T) {
out: out{config: types.Config{Ignition: types.Ignition{Version: types.MaxVersion.String()}}},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0-experimental"}}`)},
in: in{config: []byte(`{"ignition": {"version": "3.5.0"}}`)},
out: out{config: types.Config{Ignition: types.Ignition{Version: types.MaxVersion.String()}}},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0"}}`)},
in: in{config: []byte(`{"ignition": {"version": "3.6.0-experimental"}}`)},
out: out{err: errors.ErrUnknownVersion},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.6.0"}}`)},
in: in{config: []byte(`{"ignition": {"version": "3.7.0"}}`)},
out: out{err: errors.ErrUnknownVersion},
},
{
Expand All @@ -198,7 +202,7 @@ func TestParse(t *testing.T) {
out: out{err: errors.ErrInvalid},
},
{
in: in{config: []byte(`{"ignition": {"version": "3.5.0-experimental"}, "storage": {"filesystems": [{"format": "ext4", "label": "zzzzzzzzzzzzzzzzzzzzzzzzzzz"}]}}`)},
in: in{config: []byte(`{"ignition": {"version": "3.5.0"}, "storage": {"filesystems": [{"format": "ext4", "label": "zzzzzzzzzzzzzzzzzzzzzzzzzzz"}]}}`)},
out: out{err: errors.ErrInvalid},
},
}
Expand Down
2 changes: 1 addition & 1 deletion config/v3_5/translate/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package translate
import (
"github.com/coreos/ignition/v2/config/translate"
old_types "github.com/coreos/ignition/v2/config/v3_4/types"
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_5/types"
)

func translateIgnition(old old_types.Ignition) (ret types.Ignition) {
Expand Down
5 changes: 2 additions & 3 deletions config/v3_5/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ import (

var (
MaxVersion = semver.Version{
Major: 3,
Minor: 5,
PreRelease: "experimental",
Major: 3,
Minor: 5,
}
)

Expand Down
2 changes: 1 addition & 1 deletion config/v3_5/types/schema.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package types

// generated by "schematyper --package=types config/v3_5_experimental/schema/ignition.json -o config/v3_5_experimental/types/schema.go --root-type=Config" -- DO NOT EDIT
// generated by "schematyper --package=types config/v3_5/schema/ignition.json -o config/v3_5/types/schema.go --root-type=Config" -- DO NOT EDIT

type Cex struct {
Enabled *bool `json:"enabled,omitempty"`
Expand Down

0 comments on commit 3b0b89b

Please sign in to comment.