Skip to content

Commit 63f3428

Browse files
committed
feat: Implement password encryption and HTTP registration for login functionality
Signed-off-by: cormick <[email protected]>
1 parent 80fb3df commit 63f3428

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ vet: ## Run go vet against code.
5454
go vet ./...
5555

5656
.PHONY: test
57-
test: fmt vet
57+
test: fmt vet ## Run unit test and display the coverage.
58+
go test $$(go list ./pkg/...) -coverprofile cover.out
5859
go tool cover -func cover.out
5960

6061
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
@@ -72,7 +73,6 @@ lint: golangci-lint ## Run golangci-lint linter & yamllint
7273
.PHONY: lint-fix
7374
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
7475

75-
# 检查goimports是否已安装
7676
GOIMPORTS := $(shell command -v goimports 2> /dev/null)
7777
ifeq ($(GOIMPORTS),)
7878
GOIMPORTS_INSTALL = go install golang.org/x/tools/cmd/goimports@latest
@@ -100,8 +100,6 @@ $(LOCALBIN):
100100

101101
.PHONY: gen
102102
gen: gen-mockery## Generate all we need!
103-
echo "generating-openapi"
104-
GOBIN=$(LOCALBIN) go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen -config ${SERVER_DIR}/api/cfg.yaml ${SERVER_DIR}/api/api.yaml
105103

106104
.PHONY: gen-mockery check-mockery install-mockery
107105
gen-mockery: check-mockery ## Generate mockery code

pkg/config/login_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func TestNewLogin(t *testing.T) {
2828
if login.Password != "" {
2929
t.Errorf("expected empty password, got %s", login.Password)
3030
}
31-
if login.PasswordStdin != false {
32-
t.Errorf("expected PasswordStdin to be false, got %v", login.PasswordStdin)
31+
if login.PasswordStdin != true {
32+
t.Errorf("expected PasswordStdin to be true, got %v", login.PasswordStdin)
3333
}
3434
}
3535

pkg/modelfile/modelfile_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package modelfile
1919
import (
2020
"errors"
2121
"os"
22+
"sort"
2223
"testing"
2324

2425
"github.com/stretchr/testify/assert"
@@ -199,8 +200,12 @@ name bar
199200

200201
assert.NoError(err)
201202
assert.NotNil(mf)
202-
assert.Equal(tc.configs, mf.GetConfigs())
203-
assert.Equal(tc.models, mf.GetModels())
203+
configs := mf.GetConfigs()
204+
models := mf.GetModels()
205+
sort.Strings(configs)
206+
sort.Strings(models)
207+
assert.Equal(tc.configs, configs)
208+
assert.Equal(tc.models, models)
204209
assert.Equal(tc.name, mf.GetName())
205210
assert.Equal(tc.arch, mf.GetArch())
206211
assert.Equal(tc.family, mf.GetFamily())

test/mocks/backend/backend.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/mocks/modelfile/modelfile.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/mocks/storage/storage.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)