mirror of
https://tvoygit.ru/Djam/artmigrator.git
synced 2025-02-23 10:22:45 +00:00
add compose file
This commit is contained in:
parent
9071500bbf
commit
51635e0800
3 changed files with 105 additions and 0 deletions
53
docker/docker-compose.yaml
Normal file
53
docker/docker-compose.yaml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
nexus:
|
||||||
|
image: docker.io/sonatype/nexus3
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
volumes:
|
||||||
|
- nexus-data:/nexus-data
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
placement:
|
||||||
|
constraints: [node.role == manager]
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "0.5"
|
||||||
|
memory: 2G
|
||||||
|
reservations:
|
||||||
|
cpus: "0.25"
|
||||||
|
memory: 1G
|
||||||
|
environment:
|
||||||
|
- NEXUS_CONTEXT_PATH=/nexus
|
||||||
|
- NEXUS_SECURITY_ANONYMOUS_ENABLED=true
|
||||||
|
- NEXUS_SECURITY_REALM=local
|
||||||
|
|
||||||
|
gitea:
|
||||||
|
image: codeberg.org/forgejo/forgejo:9.0
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
volumes:
|
||||||
|
- gitea-data:/data
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
placement:
|
||||||
|
constraints: [node.role == manager]
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "0.5"
|
||||||
|
memory: 2G
|
||||||
|
reservations:
|
||||||
|
cpus: "0.25"
|
||||||
|
memory: 1G
|
||||||
|
environment:
|
||||||
|
- GITEA_ROOT_URL=http://gitea:3000
|
||||||
|
- GITEA_DB_TYPE=sqlite3
|
||||||
|
- GITEA_DB_PATH=/data/gitea.db
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
nexus-data:
|
||||||
|
driver: local
|
||||||
|
gitea-data:
|
||||||
|
driver: local
|
||||||
|
|
16
repository/gitea/gitea_mock.go
Normal file
16
repository/gitea/gitea_mock.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// gitea_mock.go
|
||||||
|
|
||||||
|
package gitea
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockClient struct {
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockClient) ArtifactExists(owner, repo, artifact string) (bool, error) {
|
||||||
|
args := m.Called(owner, repo, artifact)
|
||||||
|
return args.Bool(0), args.Error(1)
|
||||||
|
}
|
36
repository/nexus/nexus_mock.go
Normal file
36
repository/nexus/nexus_mock.go
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// nexus_mock.go
|
||||||
|
package nexus
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockClient struct {
|
||||||
|
mock.Mock
|
||||||
|
Server *httptest.Server
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMockClient() *MockClient {
|
||||||
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// Здесь мы можем определить логику для обработки запросов
|
||||||
|
w.WriteHeader(200)
|
||||||
|
w.Write([]byte("artifact1\nartifact2\n"))
|
||||||
|
}))
|
||||||
|
return &MockClient{
|
||||||
|
Server: server,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockClient) GetArtifacts(repository string) ([]string, error) {
|
||||||
|
args := m.Called(repository)
|
||||||
|
return args.Get(0).([]string), args.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockClient) GetArtifactData(repository, artifact string) ([]byte, error) {
|
||||||
|
args := m.Called(repository, artifact)
|
||||||
|
return args.Get(0).([]byte), args.Error(1)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue