Commit 98165d07 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Merge branch 'cleanup' into 'master'

Numerous typos were fixed. Some unused constants, variables and arguments were removed.

See merge request !1258
parents 3587092a 780362d6
Pipeline #64911756 passed with stages
in 84 minutes and 27 seconds
......@@ -36,7 +36,7 @@ type cacheOperationTest struct {
expectedURL *url.URL
}
func onFakeMinioURLGenerator(t *testing.T, tc cacheOperationTest) func() {
func onFakeMinioURLGenerator(tc cacheOperationTest) func() {
client := new(mockMinioClient)
var err error
......@@ -62,7 +62,7 @@ func onFakeMinioURLGenerator(t *testing.T, tc cacheOperationTest) func() {
func testCacheOperation(t *testing.T, operationName string, operation func(adapter cache.Adapter) *url.URL, tc cacheOperationTest) {
t.Run(operationName, func(t *testing.T) {
cleanupMinioURLGeneratorMock := onFakeMinioURLGenerator(t, tc)
cleanupMinioURLGeneratorMock := onFakeMinioURLGenerator(tc)
defer cleanupMinioURLGeneratorMock()
cacheConfig := defaultCacheFactory()
......
......@@ -30,7 +30,7 @@ func emptyCredentialsCacheFactory() *common.CacheConfig {
type minioClientInitializationTest struct {
errorOnInitialization bool
configuractionFactory func() *common.CacheConfig
configurationFactory func() *common.CacheConfig
expectedToUseIAM bool
expectedInsecure bool
......@@ -94,18 +94,18 @@ func TestMinioClientInitialization(t *testing.T) {
tests := map[string]minioClientInitializationTest{
"error-on-initialization": {
errorOnInitialization: true,
configuractionFactory: defaultCacheFactory,
configurationFactory: defaultCacheFactory,
},
"should-use-IAM": {
configuractionFactory: emptyCredentialsCacheFactory,
expectedToUseIAM: true,
configurationFactory: emptyCredentialsCacheFactory,
expectedToUseIAM: true,
},
"should-use-explicit-credentials": {
configuractionFactory: defaultCacheFactory,
configurationFactory: defaultCacheFactory,
},
"should-use-explicit-credentials-with-insecure": {
configuractionFactory: insecureCacheFactory,
expectedInsecure: true,
configurationFactory: insecureCacheFactory,
expectedInsecure: true,
},
}
......@@ -117,7 +117,7 @@ func TestMinioClientInitialization(t *testing.T) {
cleanupMinioCredentialsMock := runOnFakeMinioWithCredentials(t, test)
defer cleanupMinioCredentialsMock()
cacheConfig := test.configuractionFactory()
cacheConfig := test.configurationFactory()
client, err := newMinioClient(cacheConfig.S3)
if test.errorOnInitialization {
......
......@@ -12,7 +12,6 @@ import (
const fileArchiverUntrackedFile = "untracked_test_file.txt"
const fileArchiverUntrackedUnicodeFile = "неотслеживаемый_тестовый_файл.txt"
const fileArchiverArchiveZipFile = "archive.zip"
const fileArchiverOtherFile = "other_test_file.txt"
const fileArchiverNotExistingFile = "not_existing_file.txt"
const fileArchiverAbsoluteFile = "/absolute.txt"
const fileArchiverRelativeFile = "../../../relative.txt"
......@@ -60,7 +59,7 @@ func TestCacheArchiverAddingFile(t *testing.T) {
assert.Contains(t, f.sortedFiles(), fileArchiverUntrackedFile)
}
func TestFileArchiverToFailOnAbsoulteFile(t *testing.T) {
func TestFileArchiverToFailOnAbsoluteFile(t *testing.T) {
f := fileArchiver{
Paths: []string{fileArchiverAbsoluteFile},
}
......
......@@ -16,7 +16,6 @@ import (
const (
defaultServiceName = "gitlab-runner"
defaultDisplayName = "GitLab Runner"
defaultDescription = "GitLab Runner"
)
......@@ -55,7 +54,7 @@ func runServiceInstall(s service.Service, c *cli.Context) error {
return service.Control(s, "install")
}
func runServiceStatus(displayName string, s service.Service, c *cli.Context) error {
func runServiceStatus(displayName string, s service.Service) error {
err := s.Status()
if err == nil {
fmt.Println(displayName+":", "Service is running!")
......@@ -141,7 +140,7 @@ func RunServiceControl(c *cli.Context) {
case "install":
err = runServiceInstall(s, c)
case "status":
err = runServiceStatus(svcConfig.DisplayName, s, c)
err = runServiceStatus(svcConfig.DisplayName, s)
default:
err = service.Control(s, c.Command.Name)
}
......
......@@ -37,7 +37,7 @@ directories](https://docs.gitlab.com/ce/ci/yaml/README.html#custom-build-directo
to `PATH` environment variable
1. Import or create a new virtual machine in VirtualBox
2. config Network Adapter 1 as "NAT" (that's currently the only way the gitlab-runner is able to connect over ssh into the guest)
3. (optional) config another Network Adapter as "Bridged networking" to get acces to the internet from the guest (for example)
3. (optional) config another Network Adapter as "Bridged networking" to get access to the internet from the guest (for example)
1. Log into the new virtual machine
1. If Windows VM, see [Checklist for Windows VMs](#checklist-for-windows-vms)
1. Install the OpenSSH server
......
......@@ -40,7 +40,7 @@ To register a Runner under GNU/Linux:
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
[hostname] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
......@@ -94,7 +94,7 @@ To register a Runner under macOS:
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
[hostname] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
......@@ -149,7 +149,7 @@ To register a Runner under Windows:
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
[hostname] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
......@@ -206,7 +206,7 @@ To register a Runner under FreeBSD:
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
[hostname] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
......@@ -271,7 +271,7 @@ To register a Runner using a Docker container:
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
[hostname] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
......
......@@ -36,14 +36,6 @@ import (
"gitlab.com/gitlab-org/gitlab-runner/session/proxy"
)
var (
TRUE = true
)
const (
TestTimeout = 15 * time.Second
)
func TestLimits(t *testing.T) {
tests := []struct {
CPU, Memory string
......
......@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
)
func callFireConcurrent(t *testing.T, lh *LogHook, repeats int, finish chan bool) {
func callFireConcurrent(lh *LogHook, repeats int, finish chan bool) {
for i := 0; i < repeats; i++ {
lh.Fire(&logrus.Entry{
Level: logrus.ErrorLevel,
......@@ -26,7 +26,7 @@ func TestConcurrentFireCall(t *testing.T) {
total := times * repeats
for i := 0; i < times; i++ {
go callFireConcurrent(t, &lh, repeats, finish)
go callFireConcurrent(&lh, repeats, finish)
}
finished := 0
......@@ -42,7 +42,7 @@ func TestConcurrentFireCall(t *testing.T) {
assert.Equal(t, int64(total), *lh.errorsNumber[logrus.ErrorLevel], "Should fire log_hook N times")
}
func callCollectConcurrent(t *testing.T, lh *LogHook, repeats int, ch chan<- prometheus.Metric, finish chan bool) {
func callCollectConcurrent(lh *LogHook, repeats int, ch chan<- prometheus.Metric, finish chan bool) {
for i := 0; i < repeats; i++ {
lh.Collect(ch)
finish <- true
......@@ -65,8 +65,8 @@ func TestCouncurrentFireCallWithCollect(t *testing.T) {
}()
for i := 0; i < times; i++ {
go callFireConcurrent(t, &lh, repeats, finish)
go callCollectConcurrent(t, &lh, repeats, ch, finish)
go callFireConcurrent(&lh, repeats, finish)
go callCollectConcurrent(&lh, repeats, ch, finish)
}
finished := 0
......
......@@ -112,8 +112,6 @@ func ShellEscape(str string) string {
literal(char)
case char <= BACKTICK:
quoted(char)
case char <= LOWERCASE_Z:
literal(char)
case char <= TILDA:
quoted(char)
case char == DEL:
......
......@@ -20,8 +20,6 @@ var (
jobConfig = common.RunnerConfig{}
jobCredentials = &common.JobCredentials{ID: -1}
jobOutputLimit = common.RunnerConfig{OutputLimit: 1}
noTrace *string
)
func matchJobState(jobInfo common.UpdateJobInfo, id int, state common.JobState, failureReason common.JobFailureReason) bool {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment