nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: osbuild/osbuild-composer
Pull request #276 (2020-03-04 12:24:25)

[test] [docs]: Add instructions how to install build-deps in test/README
serves as a reference and will also help less experienced folks


Patch:
diff --git a/internal/blueprint/blueprint.go b/internal/blueprint/blueprint.go
index aa6c6a133..b3785a22b 100644
--- a/internal/blueprint/blueprint.go
+++ b/internal/blueprint/blueprint.go
@@ -65,6 +65,9 @@ func (b *Blueprint) Initialize() error {
 	if b.Groups == nil {
 		b.Groups = []Group{}
 	}
+	if b.Version == "" {
+		b.Version = "0.0.0"
+	}
 	// Return an error if the version is not valid
 	_, err := semver.NewVersion(b.Version)
 	if err != nil {


Test patch:
diff --git a/internal/blueprint/blueprint_test.go b/internal/blueprint/blueprint_test.go
index 6ab102ba5..77dfc648a 100644
--- a/internal/blueprint/blueprint_test.go
+++ b/internal/blueprint/blueprint_test.go
@@ -42,7 +42,7 @@ func TestBlueprintInitialize(t *testing.T) {
 		NewBlueprint  Blueprint
 		ExpectedError bool
 	}{
-		{Blueprint{Name: "bp-test-1", Description: "Empty version", Version: ""}, true},
+		{Blueprint{Name: "bp-test-1", Description: "Empty version", Version: ""}, false},
 		{Blueprint{Name: "bp-test-2", Description: "Invalid version 1", Version: "0"}, true},
 		{Blueprint{Name: "bp-test-2", Description: "Invalid version 2", Version: "0.0"}, true},
 		{Blueprint{Name: "bp-test-3", Description: "Invalid version 3", Version: "0.0.0.0"}, true},
diff --git a/internal/weldr/api_test.go b/internal/weldr/api_test.go
index 1691f6adb..319030c21 100644
--- a/internal/weldr/api_test.go
+++ b/internal/weldr/api_test.go
@@ -71,6 +71,7 @@ func TestBlueprintsNew(t *testing.T) {
 		ExpectedStatus int
 		ExpectedJSON   string
 	}{
+		{"POST", "/api/v0/blueprints/new", `{"name":"test","description":"Test","packages":[],"version":""}`, http.StatusOK, `{"status":true}`},
 		{"POST", "/api/v0/blueprints/new", `{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`, http.StatusOK, `{"status":true}`},
 	}
 
diff --git a/test/README.md b/test/README.md
index 6c1f612f5..420d461f7 100644
--- a/test/README.md
+++ b/test/README.md
@@ -9,6 +9,8 @@ command line interface. Implementation is under `cmd/osbuild-tests/`.
 The easiest way to get started with integration testing from a git
 checkout is:
 
+* `dnf -y install rpm-build`
+* `dnf -y builddep golang-github-osbuild-composer.spec`
 * `make rpm` to build the software under test
 * `dnf install output/x86_64/golang-github-osbuild-composer-*.rpm` - this will
   install both osbuild-composer, its -debuginfo, -debugsource and -tests packages
Repository: osbuild/osbuild-composer
Pull request #279 (2020-03-04 17:38:17)

blueprint: add default version
If the user creates a new blueprint with no version specified, the blueprint struct uses "0.0.0" as the default version. Blueprint tests for a blueprint with an empty version now expect no error.


Patch:
diff --git a/internal/blueprint/blueprint.go b/internal/blueprint/blueprint.go
index aa6c6a133..b3785a22b 100644
--- a/internal/blueprint/blueprint.go
+++ b/internal/blueprint/blueprint.go
@@ -65,6 +65,9 @@ func (b *Blueprint) Initialize() error {
 	if b.Groups == nil {
 		b.Groups = []Group{}
 	}
+	if b.Version == "" {
+		b.Version = "0.0.0"
+	}
 	// Return an error if the version is not valid
 	_, err := semver.NewVersion(b.Version)
 	if err != nil {


Test patch:
diff --git a/internal/blueprint/blueprint_test.go b/internal/blueprint/blueprint_test.go
index 6ab102ba5..77dfc648a 100644
--- a/internal/blueprint/blueprint_test.go
+++ b/internal/blueprint/blueprint_test.go
@@ -42,7 +42,7 @@ func TestBlueprintInitialize(t *testing.T) {
 		NewBlueprint  Blueprint
 		ExpectedError bool
 	}{
-		{Blueprint{Name: "bp-test-1", Description: "Empty version", Version: ""}, true},
+		{Blueprint{Name: "bp-test-1", Description: "Empty version", Version: ""}, false},
 		{Blueprint{Name: "bp-test-2", Description: "Invalid version 1", Version: "0"}, true},
 		{Blueprint{Name: "bp-test-2", Description: "Invalid version 2", Version: "0.0"}, true},
 		{Blueprint{Name: "bp-test-3", Description: "Invalid version 3", Version: "0.0.0.0"}, true},
diff --git a/internal/weldr/api_test.go b/internal/weldr/api_test.go
index 1691f6adb..319030c21 100644
--- a/internal/weldr/api_test.go
+++ b/internal/weldr/api_test.go
@@ -71,6 +71,7 @@ func TestBlueprintsNew(t *testing.T) {
 		ExpectedStatus int
 		ExpectedJSON   string
 	}{
+		{"POST", "/api/v0/blueprints/new", `{"name":"test","description":"Test","packages":[],"version":""}`, http.StatusOK, `{"status":true}`},
 		{"POST", "/api/v0/blueprints/new", `{"name":"test","description":"Test","packages":[{"name":"httpd","version":"2.4.*"}],"version":"0.0.0"}`, http.StatusOK, `{"status":true}`},
 	}