[Fix] first try to fix the build error
This commit is contained in:
parent
0fef88f07e
commit
c9e944d9f3
|
@ -33,7 +33,7 @@ func ProductExists(id int64) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
url := fmt.Sprintf(ProductURL, id)
|
url := fmt.Sprintf(ProductURL, id)
|
||||||
log.Log.WithField("url", url).Info("exists product?")
|
log.Log.WithField("url", url).Info("does the product exist?")
|
||||||
res, err := http.Get(url)
|
res, err := http.Get(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
@ -20,19 +20,19 @@ func TestProductExists(t *testing.T) {
|
||||||
}
|
}
|
||||||
go srv.ListenAndServe()
|
go srv.ListenAndServe()
|
||||||
|
|
||||||
ok, err := ProductExists(3)
|
ok, err := ProductExists(6)
|
||||||
assert.True(ok)
|
assert.True(ok)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
// test cache
|
// test cache
|
||||||
ok, err = ProductExists(3)
|
ok, err = ProductExists(6)
|
||||||
assert.True(ok)
|
assert.True(ok)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
productExistCache = make(map[int64]boolMicroServiceCache)
|
productExistCache = make(map[int64]boolMicroServiceCache)
|
||||||
ProductURL = "http://localhost:8081/api-test/product/%d/"
|
ProductURL = "http://localhost:8081/api-test/product/%d/"
|
||||||
|
|
||||||
ok, err = ProductExists(3)
|
ok, err = ProductExists(6)
|
||||||
assert.Error(err)
|
assert.Error(err)
|
||||||
|
|
||||||
srv.Close()
|
srv.Close()
|
||||||
|
|
Reference in New Issue