feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
package sdk
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
2026-03-26 17:41:53 +00:00
|
|
|
|
|
|
|
|
"dappco.re/go/core/build/internal/ax"
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
)
|
|
|
|
|
|
2026-03-26 17:41:53 +00:00
|
|
|
func TestDiff_NoBreaking_Good(t *testing.T) {
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
tmpDir := t.TempDir()
|
|
|
|
|
|
|
|
|
|
baseSpec := `openapi: "3.0.0"
|
|
|
|
|
info:
|
|
|
|
|
title: Test API
|
|
|
|
|
version: "1.0.0"
|
|
|
|
|
paths:
|
|
|
|
|
/health:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getHealth
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
`
|
|
|
|
|
revSpec := `openapi: "3.0.0"
|
|
|
|
|
info:
|
|
|
|
|
title: Test API
|
|
|
|
|
version: "1.1.0"
|
|
|
|
|
paths:
|
|
|
|
|
/health:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getHealth
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
/status:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getStatus
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
`
|
2026-03-26 17:41:53 +00:00
|
|
|
basePath := ax.Join(tmpDir, "base.yaml")
|
|
|
|
|
revPath := ax.Join(tmpDir, "rev.yaml")
|
|
|
|
|
_ = ax.WriteFile(basePath, []byte(baseSpec), 0644)
|
|
|
|
|
_ = ax.WriteFile(revPath, []byte(revSpec), 0644)
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
|
|
|
|
|
result, err := Diff(basePath, revPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Diff failed: %v", err)
|
|
|
|
|
}
|
|
|
|
|
if result.Breaking {
|
|
|
|
|
t.Error("expected no breaking changes for adding endpoint")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 17:41:53 +00:00
|
|
|
func TestDiff_Breaking_Good(t *testing.T) {
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
tmpDir := t.TempDir()
|
|
|
|
|
|
|
|
|
|
baseSpec := `openapi: "3.0.0"
|
|
|
|
|
info:
|
|
|
|
|
title: Test API
|
|
|
|
|
version: "1.0.0"
|
|
|
|
|
paths:
|
|
|
|
|
/health:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getHealth
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
/users:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getUsers
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
`
|
|
|
|
|
revSpec := `openapi: "3.0.0"
|
|
|
|
|
info:
|
|
|
|
|
title: Test API
|
|
|
|
|
version: "2.0.0"
|
|
|
|
|
paths:
|
|
|
|
|
/health:
|
|
|
|
|
get:
|
|
|
|
|
operationId: getHealth
|
|
|
|
|
responses:
|
|
|
|
|
"200":
|
|
|
|
|
description: OK
|
|
|
|
|
`
|
2026-03-26 17:41:53 +00:00
|
|
|
basePath := ax.Join(tmpDir, "base.yaml")
|
|
|
|
|
revPath := ax.Join(tmpDir, "rev.yaml")
|
|
|
|
|
_ = ax.WriteFile(basePath, []byte(baseSpec), 0644)
|
|
|
|
|
_ = ax.WriteFile(revPath, []byte(revSpec), 0644)
|
feat: extract build/, release/, sdk/ from go-devops
Build system (8 builders, signing, archiving), release pipeline
(7 publishers, versioning, changelog), and SDK generation
(OpenAPI diff, code gen). 18K LOC, all tests pass except Go
builder workspace isolation (pre-existing).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 12:37:36 +00:00
|
|
|
|
|
|
|
|
result, err := Diff(basePath, revPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Diff failed: %v", err)
|
|
|
|
|
}
|
|
|
|
|
if !result.Breaking {
|
|
|
|
|
t.Error("expected breaking change for removed endpoint")
|
|
|
|
|
}
|
|
|
|
|
}
|