Compare commits
3 Commits
debt/tt/#6
...
v0.7.0
Author | SHA1 | Date | |
---|---|---|---|
989e7079a5 | |||
edfd4e2e06
|
|||
1c8d5146fb |
28
.drone.yml
28
.drone.yml
@ -15,27 +15,23 @@ steps:
|
|||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
- tag
|
- tag
|
||||||
- name: backend
|
- name: build
|
||||||
image: gitea/gitea:1.16.8
|
image: goreleaser/goreleaser
|
||||||
detach: true
|
|
||||||
commands:
|
commands:
|
||||||
- su git
|
- goreleaser build --snapshot
|
||||||
- gitea admin user create --username test --password $GITEA_PASSWORD --must-change-password false --admin --email test@mail.org
|
when:
|
||||||
- /usr/bin/entrypoint /bin/s6-svscan /etc/s6
|
event:
|
||||||
environment:
|
- push
|
||||||
GITEA_PASSWORD:
|
- pull_request
|
||||||
from_secret: GITEA_TEST_PASSWORD
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000
|
||||||
|
memory: 1024MiB
|
||||||
- name: test
|
- name: test
|
||||||
image: golang:1.18.3-alpine3.16
|
image: golang:1.18.3-alpine3.16
|
||||||
commands:
|
commands:
|
||||||
- "apk add --update --no-cache make build-base"
|
- "apk add --update --no-cache make build-base"
|
||||||
- "make testacc"
|
- "make test"
|
||||||
environment:
|
|
||||||
TF_ACC: 1
|
|
||||||
GITEA_BASE_URL: "http://localhost:3000"
|
|
||||||
GITEA_USERNAME: test
|
|
||||||
GITEA_PASSWORD:
|
|
||||||
from_secret: GITEA_TEST_PASSWORD
|
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
4
Makefile
4
Makefile
@ -3,7 +3,7 @@ GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
|
|||||||
|
|
||||||
GOFMT ?= gofmt -s
|
GOFMT ?= gofmt -s
|
||||||
|
|
||||||
VERSION = 0.6.1
|
VERSION = 0.7.0
|
||||||
|
|
||||||
test: fmt-check
|
test: fmt-check
|
||||||
go test -i $(TEST) || exit 1
|
go test -i $(TEST) || exit 1
|
||||||
@ -11,7 +11,7 @@ test: fmt-check
|
|||||||
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
|
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
|
||||||
|
|
||||||
testacc: fmt-check
|
testacc: fmt-check
|
||||||
go test -v $(TEST) $(TESTARGS) -timeout 40m
|
TF_ACC=1 go test -v $(TEST) $(TESTARGS) -timeout 40m
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@echo "go vet ."
|
@echo "go vet ."
|
||||||
|
@ -17,7 +17,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
gitea = {
|
gitea = {
|
||||||
source = "Lerentis/gitea"
|
source = "Lerentis/gitea"
|
||||||
version = "0.3.0"
|
version = "0.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
gitea = {
|
gitea = {
|
||||||
source = "terraform.local/lerentis/gitea"
|
source = "terraform.local/lerentis/gitea"
|
||||||
version = "0.6.1"
|
version = "0.7.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
package gitea
|
package gitea
|
||||||
|
|
||||||
/*func TestAccDataSourceGiteaUser_basic(t *testing.T) {
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
|
||||||
|
"github.com/hashicorp/terraform-plugin-sdk/terraform"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccDataSourceGiteaUser_basic(t *testing.T) {
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
@ -51,4 +59,4 @@ data "gitea_user" "foo" {
|
|||||||
data "gitea_user" "self" {
|
data "gitea_user" "self" {
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
}*/
|
}
|
||||||
|
@ -118,5 +118,8 @@ func validateAPIURLVersion(value interface{}, key string) (ws []string, es []err
|
|||||||
if strings.HasSuffix(v, "/api/v1") || strings.HasSuffix(v, "/api/v1/") {
|
if strings.HasSuffix(v, "/api/v1") || strings.HasSuffix(v, "/api/v1/") {
|
||||||
es = append(es, fmt.Errorf("terraform-gitea-provider base URL format is incorrect; Please leave out API Path %s", v))
|
es = append(es, fmt.Errorf("terraform-gitea-provider base URL format is incorrect; Please leave out API Path %s", v))
|
||||||
}
|
}
|
||||||
|
if strings.Contains(v, "localhost") && strings.Contains(v, ".") {
|
||||||
|
es = append(es, fmt.Errorf("terraform-gitea-provider base URL violates RFC 2606; Please do not define a subdomain for localhost!"))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
package gitea
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/terraform"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestAccResourceGiteaUser_basic(t *testing.T) {
|
|
||||||
name := fmt.Sprintf("user-%d", 1)
|
|
||||||
mail := fmt.Sprintf("%s@test.org", name)
|
|
||||||
fqrn := fmt.Sprintf("gitea_user.%s", name)
|
|
||||||
|
|
||||||
userSimple := fmt.Sprintf(`
|
|
||||||
resource "gitea_user" "%s" {
|
|
||||||
username = "%s"
|
|
||||||
login_name = "%s"
|
|
||||||
email = "%s"
|
|
||||||
password = "Geheim1!"
|
|
||||||
|
|
||||||
}
|
|
||||||
`, name, name, name, mail)
|
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Providers: testAccProviders,
|
|
||||||
CheckDestroy: testAccCheckExampleResourceDestroy,
|
|
||||||
Steps: []resource.TestStep{
|
|
||||||
{
|
|
||||||
Config: userSimple,
|
|
||||||
ResourceName: fqrn,
|
|
||||||
Check: resource.ComposeTestCheckFunc(
|
|
||||||
resource.TestCheckResourceAttr(fqrn, "username", name),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAccCheckExampleResourceDestroy(s *terraform.State) error {
|
|
||||||
// retrieve the connection established in Provider configuration
|
|
||||||
//conn := testAccProvider.Meta().(*ExampleClient)
|
|
||||||
|
|
||||||
// loop through the resources in state, verifying each widget
|
|
||||||
// is destroyed
|
|
||||||
for _, rs := range s.RootModule().Resources {
|
|
||||||
if rs.Type != "example_widget" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve our widget by referencing it's state ID for API lookup
|
|
||||||
//request := &example.DescribeWidgets{
|
|
||||||
// IDs: []string{rs.Primary.ID},
|
|
||||||
//}
|
|
||||||
|
|
||||||
//response, err := conn.DescribeWidgets(request)
|
|
||||||
//if err == nil {
|
|
||||||
// if len(response.Widgets) > 0 && *response.Widgets[0].ID == rs.Primary.ID {
|
|
||||||
// return fmt.Errorf("Widget (%s) still exists.", rs.Primary.ID)
|
|
||||||
// }
|
|
||||||
// return nil
|
|
||||||
//}
|
|
||||||
|
|
||||||
// If the error is equivalent to 404 not found, the widget is destroyed.
|
|
||||||
// Otherwise return the error
|
|
||||||
//if !strings.Contains(err.Error(), "Widget not found") {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAccResourceGiteaUserSimple(fqrn string, name string, mail string) string {
|
|
||||||
return fmt.Sprintf(`
|
|
||||||
resource "gitea_user" "%s" {
|
|
||||||
username = "%s"
|
|
||||||
login_name = "%s"
|
|
||||||
email = "%s"
|
|
||||||
password = "Geheim1!"
|
|
||||||
|
|
||||||
}
|
|
||||||
`, fqrn, name, name, mail)
|
|
||||||
}
|
|
Reference in New Issue
Block a user