mirror of https://github.com/aldy505/cheapcash.git
fix: removing race from ci
This commit is contained in:
parent
72dc4921df
commit
07a1b112fe
|
@ -15,7 +15,7 @@ jobs:
|
||||||
- name: Go vet
|
- name: Go vet
|
||||||
run: go vet -v
|
run: go vet -v
|
||||||
- name: Go test
|
- name: Go test
|
||||||
run: go test -v -race -coverprofile=coverage.out -covermode=atomic -failfast
|
run: go test -v -coverprofile=coverage.out -covermode=atomic -failfast
|
||||||
- uses: github/codeql-action/init@v1
|
- uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: go
|
languages: go
|
||||||
|
|
|
@ -35,7 +35,7 @@ func TestExists(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExists_Conccurency(t *testing.T) {
|
func TestExists_Concurrency(t *testing.T) {
|
||||||
rand := strconv.Itoa(rand.Int())
|
rand := strconv.Itoa(rand.Int())
|
||||||
c := cheapcash.Default()
|
c := cheapcash.Default()
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package cheapcash
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
func (c *Cache) Delete(key string) error {
|
func (c *Cache) Delete(key string) error {
|
||||||
check, err := c.Exists(c.Path + "/" + key)
|
check, err := c.Exists(c.Path + "/" + key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func TestDelete(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDelete_Conccurency(t *testing.T) {
|
func TestDelete_Concurrency(t *testing.T) {
|
||||||
rand := strconv.Itoa(rand.Int())
|
rand := strconv.Itoa(rand.Int())
|
||||||
c := cheapcash.Default()
|
c := cheapcash.Default()
|
||||||
err := c.Write(rand, []byte("value"))
|
err := c.Write(rand, []byte("value"))
|
||||||
|
|
|
@ -26,7 +26,7 @@ func TestRead(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRead_Conccurency(t *testing.T) {
|
func TestRead_Concurrency(t *testing.T) {
|
||||||
rand := strconv.Itoa(rand.Int())
|
rand := strconv.Itoa(rand.Int())
|
||||||
c := cheapcash.Default()
|
c := cheapcash.Default()
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func TestRead_Conccurency(t *testing.T) {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
readFunc := func(){
|
readFunc := func() {
|
||||||
r, err := c.Read(rand)
|
r, err := c.Read(rand)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("an error was thrown:", err)
|
t.Error("an error was thrown:", err)
|
||||||
|
|
|
@ -15,25 +15,25 @@ func TestWrite(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWrite_Conccurency(t *testing.T) {
|
func TestWrite_Concurrency(t *testing.T) {
|
||||||
c := cheapcash.Default()
|
c := cheapcash.Default()
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
writeFunc := func() {
|
writeFunc := func() {
|
||||||
err := c.Write("key1", []byte("value1"))
|
err := c.Write("key1", []byte("value1"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("an error was thrown:", err)
|
t.Error("an error was thrown:", err)
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(5)
|
wg.Add(5)
|
||||||
go writeFunc()
|
go writeFunc()
|
||||||
go writeFunc()
|
go writeFunc()
|
||||||
go writeFunc()
|
go writeFunc()
|
||||||
go writeFunc()
|
go writeFunc()
|
||||||
go writeFunc()
|
go writeFunc()
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue