You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After making a fork of this repository and checkout out from master branch, I find that testing scripts in Go corresponding to Chapters 2 and 5 are failing in Github Codespaces VM (Ubuntu 18.04.1; Docker Compose 1.29.2; Go 1.20.2). I have enabled Redis according to instructions as found at redis-in-action/golang
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker-compose up -d
Creating network "golang_my-test" with driver "bridge"
Building golang
[+] Building 21.2s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.4s
=> => transferring dockerfile: 224B 0.0s
=> [internal] load .dockerignore 0.5s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.14-alpine3.11 1.6s
=> [auth] library/golang:pull token for registry-1.docker.io 0.0s
=> [1/5] FROM docker.io/library/golang:1.14-alpine3.11@sha256:4f1c80d88c5879067f063770c774a8ffd4de47b684333cdbe9a4ce661931b9b8 10.1s
=> => resolve docker.io/library/golang:1.14-alpine3.11@sha256:4f1c80d88c5879067f063770c774a8ffd4de47b684333cdbe9a4ce661931b9b8 0.3s
=> => sha256:7ae5d4ed80128862597e54747828838e317dacf76670e58dbd9294cc268eb21b 1.36kB / 1.36kB 0.0s
=> => sha256:d8bc21febf89d0a2f2937b0e7f35f58d5570a3cdaaa283580551cc565558efab 4.62kB / 4.62kB 0.0s
=> => sha256:4f1c80d88c5879067f063770c774a8ffd4de47b684333cdbe9a4ce661931b9b8 1.65kB / 1.65kB 0.0s
=> => sha256:01872fc92c6cf715d78171a1b715efc05c9b103364c22cf4649e1d44fe2245bf 153B / 153B 0.3s
=> => sha256:780d39f1cd5d8c6428547f47a5737bac30da1feff7c94335f65094ca77e2cebf 299.55kB / 299.55kB 0.5s
=> => sha256:0a6724ff3fcd51338afdfdc2b1d4ffd04569818e31efad957213d67c29b45101 2.81MB / 2.81MB 0.4s
=> => sha256:875fef68e8ab2a5b953f2425137b92b5c8091fbe79604aed01793184e8efbb65 107.28MB / 107.28MB 2.4s
=> => extracting sha256:0a6724ff3fcd51338afdfdc2b1d4ffd04569818e31efad957213d67c29b45101 0.1s
=> => sha256:77ac76ad90fed421c2cb5a03fbf6486e4e8a83390168a7187fde99181b54c5f6 126B / 126B 0.7s
=> => extracting sha256:780d39f1cd5d8c6428547f47a5737bac30da1feff7c94335f65094ca77e2cebf 0.1s
=> => extracting sha256:01872fc92c6cf715d78171a1b715efc05c9b103364c22cf4649e1d44fe2245bf 0.0s
=> => extracting sha256:875fef68e8ab2a5b953f2425137b92b5c8091fbe79604aed01793184e8efbb65 5.1s
=> => extracting sha256:77ac76ad90fed421c2cb5a03fbf6486e4e8a83390168a7187fde99181b54c5f6 0.0s
=> [internal] load build context 0.4s
=> => transferring context: 143.39kB 0.0s
=> [2/5] WORKDIR /src/app 0.3s
=> [3/5] COPY go.mod go.sum ./ 0.4s
=> [4/5] RUN go mod download 4.3s
=> [5/5] COPY .. 0.5s
=> exporting to image 2.8s
=> => exporting layers 2.7s
=> => writing image sha256:e6b98742660eabebec2fdb7bc491c4eff9bd744e6c1789db8381a0f24fa803d8 0.0s
=> => naming to docker.io/library/golang_golang 0.0s
WARNING: Image for service golang was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Pulling redis (redis:6.0-rc-alpine)...
6.0-rc-alpine: Pulling from library/redis
cbdbe7a5bc2a: Pull complete
dc0373118a0d: Pull complete
cfd369fe6256: Pull complete
09a935bf1649: Pull complete
23985a6095ec: Pull complete
561cada643a7: Pull complete
Digest: sha256:ff868fb1ff9c8b42a23ba1a1a43c5c13a18ba737e1234321d42c55d924e4a057
Status: Downloaded newer image for redis:6.0-rc-alpine
Creating redis-in-action-golang ... done
Creating redis-in-action-redis ... done
@rilma ➜ /workspaces/redis-in-action/golang (master) $
Chapter 2's testing script is failing as shown below:
@rilma ➜ /workspaces/redis-in-action/golang (master) $ go test ./Chapter02/redisConn_test.go -v
=== RUN TestLoginCookies
=== RUN TestLoginCookies/Test_UpdateToken
redisConn_test.go:21: We just logged-in/update token:
7673ad36-442e-4b3c-b285-300b828fad9b
redisConn_test.go:22: For user: username
redisConn_test.go:23:
What username do we get when we look-up that token?
redisConn_test.go:25: username: username
redisConn_test.go:28: Let's drop the maximum number of cookies to 0 to clean them out redisConn_test.go:29: We will start a thread to do the cleaning, while we stop it later redisConn_test.go:40: The current number of sessions still available is: 0 redisConn_test.go:41: want get 1, actual get 0=== RUN TestLoginCookies/Test_shopping_cart_cookie redisConn_test.go:46: We'll refresh our session...
redisConn_test.go:48: And add an item to the shopping cart
redisConn_test.go:51: Our shopping cart currently has: map[itemY:3]
redisConn_test.go:55: Let's clean out our sessions and carts redisConn_test.go:64: Our shopping cart now contains: map[]=== RUN TestLoginCookies/Test_cache_request redisConn_test.go:71: We are going to cache a simple request against http://test.com/?item=itemX redisConn_test.go:75: We got initial content: content for http://test.com/?item=itemX redisConn_test.go:78: To test that we've cached the request, we'll pass a bad callback redisConn_test.go:80: We ended up getting the same response! content for http://test.com/?item=itemX=== RUN TestLoginCookies/Test_cache_row redisConn_test.go:88: First, let's schedule caching of itemX every 5 seconds
redisConn_test.go:90: Our schedule looks like:
redisConn_test.go:92: itemX 1.68064047e+09
redisConn_test.go:95: We'll start a caching thread that will cache the data... redisConn_test.go:98: Our cached data looks like: redisConn_test.go:100: {"Id":"itemX","Data":"data to cache...","Cached":1680640470} redisConn_test.go:103: We'll check again in 5 seconds...
redisConn_test.go:105: Notice that the data has changed...
redisConn_test.go:107: {"Id":"itemX","Data":"data to cache...","Cached":1680640475}
redisConn_test.go:111: Let's force un-caching redisConn_test.go:115: The cache was cleared? true--- FAIL: TestLoginCookies (15.02s) --- FAIL: TestLoginCookies/Test_UpdateToken (3.00s) --- PASS: TestLoginCookies/Test_shopping_cart_cookie (3.00s) --- PASS: TestLoginCookies/Test_cache_request (0.00s) --- PASS: TestLoginCookies/Test_cache_row (9.01s)FAILFAIL command-line-arguments 15.023sFAIL@rilma ➜ /workspaces/redis-in-action/golang (master) $
Same situation with Chapter 5' script:
@rilma ➜ /workspaces/redis-in-action/golang (master) $ go test ./Chapter05/redisConn_test.go -v
=== RUN Test
=== RUN Test/Test_log_recent
redisConn_test.go:22: Let's write a few logs to the recent log redisConn_test.go:27: The current recent message log has this many messages: 5 redisConn_test.go:28: Those messages include: redisConn_test.go:30: 2023-04-04 20:37:44.981333735 +0000 UTC this is message 4 redisConn_test.go:30: 2023-04-04 20:37:44.981222936 +0000 UTC this is message 3 redisConn_test.go:30: 2023-04-04 20:37:44.981102737 +0000 UTC this is message 2 redisConn_test.go:30: 2023-04-04 20:37:44.980939539 +0000 UTC this is message 1 redisConn_test.go:30: 2023-04-04 20:37:44.980135048 +0000 UTC this is message 0=== RUN Test/Test_log_common redisConn_test.go:37: Let's write some items to the common log
redisConn_test.go:44: The current number of common messages is: 5
redisConn_test.go:45: Those common messages are:
redisConn_test.go:47: {60 message-5}
redisConn_test.go:47: {35 message-4}
redisConn_test.go:47: {32 message-3}
redisConn_test.go:47: {22 message-2}
redisConn_test.go:47: {10 message-1}
=== RUN Test/Test_counters
redisConn_test.go:54: Let's update some counters for now and a little in the future redisConn_test.go:60: We have some per-second counters: 10 redisConn_test.go:63: We have some per-5-second counters: 2 redisConn_test.go:64: These counters include: redisConn_test.go:70: [1680640665 15] redisConn_test.go:70: [1680640670 20] redisConn_test.go:75: Let's clean out some counters by setting our sample count to 0
redisConn_test.go:81: Did we clean out all of the counters? 0
=== RUN Test/Test_stats
redisConn_test.go:87: Let's add some data for our statistics! redisConn_test.go:92: We have some aggregate statistics: [zincrby stats:temp:example 1 count: 47 zincrby stats:temp:example 6 sum: 349 zincrby stats:temp:example 36 sumq: 2873] redisConn_test.go:94: Which we can also fetch manually: redisConn_test.go:96: min 5 redisConn_test.go:96: max 12 redisConn_test.go:96: count 47 redisConn_test.go:96: sum 349 redisConn_test.go:96: sumq 2873 redisConn_test.go:96: average 7.425531914893617 redisConn_test.go:96: stddev 2.4737287543395396=== RUN Test/Test_access_time redisConn_test.go:103: Let's calculate some access times...
redisConn_test.go:109: The slowest access times are:
redisConn_test.go:112: req-6
redisConn_test.go:112: req-2
redisConn_test.go:112: req-8
redisConn_test.go:112: req-7
redisConn_test.go:112: req-3
redisConn_test.go:112: req-1
redisConn_test.go:112: req-9
redisConn_test.go:112: req-5
redisConn_test.go:112: req-4
redisConn_test.go:112: req-0
=== RUN Test/Test_is_under_maintenance
redisConn_test.go:119: Are we under maintenance (we shouldn't be)? false redisConn_test.go:121: We cached this, so it should be the same: false redisConn_test.go:123: But after a sleep, it should change: true redisConn_test.go:124: Cleaning up... redisConn_test.go:127: Should be False again: false=== RUN Test/Test_ip_lookup redisConn_test.go:132: Importing IP addresses to Redis... (this may take a while)2023/04/04 20:37:58 open file fault, filename: ../Chapter05/GeoLite2-City-CSV_20200121/GeoLite2-City-Blocks-IPv4.csv, err: open ../Chapter05/GeoLite2-City-CSV_20200121/GeoLite2-City-Blocks-IPv4.csv: no such file or directoryFAIL command-line-arguments 13.692sFAIL@rilma ➜ /workspaces/redis-in-action/golang (master) $
The aforementioned scripts may require a fix. May @YangKian be suitable for providing a fix?
The text was updated successfully, but these errors were encountered:
Can you check this again? I think it was a config issue with the docker-compose file for go, along with the configuration for what to connect to. Going to close the other issue you've created as a duplicate of this, as they should be identical in cause.
Running tests with Docker Compose are healthy again but tests executed in command line cannot find the Redis service. I have a workable solution in #100. It's all about setting network_mode: "host" at the golang service. The original network setup in golang/docker-compose.yml is not needed anymore.
This doesn't resolve the failing testing cases of Chapters 2 and 5 yet.
After making a fork of this repository and checkout out from master branch, I find that testing scripts in Go corresponding to Chapters 2 and 5 are failing in Github Codespaces VM (Ubuntu 18.04.1; Docker Compose 1.29.2; Go 1.20.2). I have enabled Redis according to instructions as found at
redis-in-action/golang
Chapter 2's testing script is failing as shown below:
Same situation with Chapter 5' script:
The aforementioned scripts may require a fix. May @YangKian be suitable for providing a fix?
The text was updated successfully, but these errors were encountered: