Skip to content
Snippets Groups Projects
Commit 9bf121bd authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

merge

parent b636a139
No related branches found
No related tags found
2 merge requests!123Refactor container deployment,!90Develop
FROM golang:1.15-alpine AS builder
ARG GITLAB_USER
ARG GITLAB_TOKEN
WORKDIR /src/gosdn
COPY . .
RUN apk add git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build ./cmd/gosdn
FROM alpine:latest
EXPOSE 8443
EXPOSE 55055
COPY --from=builder /src/gosdn/gosdn .
COPY --from=builder /src/gosdn/configs ./configs
ENTRYPOINT [ "./gosdn" ]
CMD [""]
FROM golang:1.15-alpine AS builder
ARG GITLAB_USER
ARG GITLAB_TOKEN
WORKDIR /src/gosdn
COPY . .
RUN apk add git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -race ./cmd/gosdn
FROM alpine:latest
EXPOSE 8443
EXPOSE 55055
COPY --from=builder /src/gosdn/gosdn .
COPY --from=builder /src/gosdn/configs ./configs
ENTRYPOINT [ "./gosdn" ]
CMD [""]
......@@ -47,7 +47,6 @@ func initialize() error {
}
// TODO: Start grpc listener here
return httpAPI()
}
......@@ -76,9 +75,11 @@ func createPrincipalNetworkDomain(sbi SouthboundInterface) error {
// Run calls initialize to start the controller
func Run(ctx context.Context) error {
var initError error
coreLock.Lock()
coreOnce.Do(func() {
initError = initialize()
})
coreLock.Unlock()
if initError != nil {
log.WithFields(log.Fields{}).Error(initError)
return initError
......
......@@ -31,7 +31,7 @@ func registerHttpHandler() {
}
// deprecated
func httpAPI() (err error) {
func httpAPI() error {
registerHttpHandler()
c.httpServer = &http.Server{Addr: ":8080"}
go func() {
......
......@@ -36,6 +36,10 @@ func testSetupHTTP() {
if err := c.pndc.add(pnd); err != nil {
log.Fatal(err)
}
if err := httpAPI(); err != nil {
log.Fatal(err)
return
}
}
func Test_httpApi(t *testing.T) {
......@@ -137,10 +141,6 @@ func Test_httpApi(t *testing.T) {
wantErr: false,
},
}
if err := httpAPI(); err != nil {
t.Errorf("httpApi() error = %v", err)
return
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := http.Get(tt.request)
......
......@@ -45,6 +45,12 @@ var gnmiAddress = "141.100.70.171:6030"
// TODO: Move somewhere more sensible
func TestMain(m *testing.M) {
log.SetReportCaller(true)
if os.Getenv("GOSDN_LOG") == "nolog" {
log.SetLevel(log.PanicLevel)
}
gnmiMessages = map[string]pb.Message{
"../test/proto/cap-resp-arista-ceos": &gpb.CapabilityResponse{},
"../test/proto/req-full-node": &gpb.GetRequest{},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment