Connection to Redis is failing in golang/docker-compose.yml
rilma opened this issue · comments
After attempting for a run of testing cases via docker-composed included in golang
subdirectory (I'm using Github Codespaces VM configured with Ubuntu 18.04.1; Docker Compose 1.29.2; Go 1.20.2), I find that connection to Redis is failing (see below). I may give a try for solving the problem, unless @YangKian has a better suggestion.
@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) $ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1134cee2cdaa redis:6.0-rc-alpine "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis-in-action-redis
b267b39b0199 golang_golang "/bin/sh" 2 minutes ago Up 2 minutes redis-in-action-golang
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter0*/redisConn_test.go -v
named files must all be in one directory; have ./Chapter01/ and ./Chapter02/
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter01/redisConn_test.go -v
=== RUN Test
2023/04/04 20:29:11 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.006s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter02/redisConn_test.go -v
=== RUN TestLoginCookies
2023/04/04 20:29:21 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.004s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter03/redisConn_test.go -v
=== RUN TestLoginCookies
2023/04/04 20:29:29 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.003s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter04/redisConn_test.go -v
=== RUN Test
2023/04/04 20:29:37 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.003s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter05/redisConn_test.go -v
=== RUN Test
2023/04/04 20:29:49 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.009s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter06/redisConn_test.go -v
=== RUN Test
2023/04/04 20:30:06 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.004s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter07/redisConn_test.go -v
=== RUN Test
2023/04/04 20:30:17 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.004s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter08/redisConn_test.go -v
=== RUN Test
2023/04/04 20:30:23 Connect to redis client failed, err: dial tcp 127.0.0.1:6379: connect: connection refused
FAIL command-line-arguments 0.003s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $
This looks to be a duplicate of #98. Going to close this. Also, I updated the compose file and config, please try again.
I sync my fork so I get your recent changes into master, then I run the testing cases via Docker Compose. The connection to Redis is healthy now, but the testing cases for Chapters 2 and 5 are failing as indicated in #98. Let's see if gets resolved there. Anyway, sharing my results via Docker Compose as follows. You have fixed the issue with your recent two commits to master:
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker-compose up -d
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
Building golang
[+] Building 3.4s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.3s
=> => transferring dockerfile: 35B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.14-alpine3.11 0.8s
=> [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 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 4.84kB 0.0s
=> CACHED [2/5] WORKDIR /src/app 0.0s
=> CACHED [3/5] COPY go.mod go.sum ./ 0.0s
=> CACHED [4/5] RUN go mod download 0.0s
=> [5/5] COPY . . 0.3s
=> exporting to image 1.6s
=> => exporting layers 1.4s
=> => writing image sha256:4459e9b3f22614d90568f0c5d478aba360ef5d45903eae08041740eebe062de2 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`.
Creating redis-in-action-redis ... done
Creating redis-in-action-golang ... done
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter01/redisConn_test.go -v
=== RUN Test
redisConn_test.go:15: We posted a new article with id: 1
redisConn_test.go:19:
Its HASH looks like: map[link:http://www.google.com poster:username time:1680808032 title:A title votes:1]
redisConn_test.go:24:
We voted for the article, it now has votes: 2
redisConn_test.go:27:
The currently highest-scoring articles are:
redisConn_test.go:31: 0 map[id:article:1 link:http://www.google.com poster:username time:1680808032 title:A title votes:2]
redisConn_test.go:36:
We added the article to a new group, other articles include:
redisConn_test.go:39: 0 map[id:article:1 link:http://www.google.com poster:username time:1680808032 title:A title votes:2]
--- PASS: Test (0.03s)
PASS
ok command-line-arguments 0.038s
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter02/redisConn_test.go -v
=== RUN TestLoginCookies
=== RUN TestLoginCookies/Test_UpdateToken
redisConn_test.go:21: We just logged-in/update token:
467d1e18-2821-41d2-af88-7b0e440e71a5
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.68080805e+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":1680808050}
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":1680808055}
redisConn_test.go:111: Let's force un-caching
redisConn_test.go:115: The cache was cleared? true
--- FAIL: TestLoginCookies (15.01s)
--- 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.00s)
FAIL
FAIL command-line-arguments 15.011s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter03/redisConn_test.go -v
=== RUN TestLoginCookies
=== RUN TestLoginCookies/Test_INCR_and_DECR
=== RUN TestLoginCookies/Operation_on_substring_and_bit
=== RUN TestLoginCookies/Operation_on_list
redisConn_test.go:64: the list is: [first last new last]
redisConn_test.go:70: the list is: [new last]
redisConn_test.go:74: the list is: [b c]
=== RUN TestLoginCookies/Block_pop
redisConn_test.go:85: the list is: [item3 item1 item2]
redisConn_test.go:87: the list is: [item3 item1]
redisConn_test.go:88: the list2 is: [item2]
redisConn_test.go:90: the result of blpop: [list item3]
redisConn_test.go:92: the result of blpop: [list item1]
redisConn_test.go:94: the result of blpop: [list2 item2]
redisConn_test.go:96: the result of blpop: []
=== RUN TestLoginCookies/Operation_of_set
redisConn_test.go:108: all items in set: [b a]
redisConn_test.go:111: all items in set2: [a]
redisConn_test.go:116: the diff between two set is: [a b]
redisConn_test.go:118: the inter between two set is: [d c]
redisConn_test.go:120: the union between two set is: [d f c e b a]
=== RUN TestLoginCookies/Operation_on_hash
redisConn_test.go:131: the result of get: [v2 v3]
redisConn_test.go:136: the result of get: map[k3:v3]
redisConn_test.go:142: the result of hkeys: [short long]
=== RUN TestLoginCookies/Operation_on_zset
redisConn_test.go:166: the result of zrange: [{3 a} {4 c}]
redisConn_test.go:174: the result of zrange: [{4 c} {6 b}]
redisConn_test.go:177: the result of zrange: [{0 d} {1 a} {1 c} {2 b}]
redisConn_test.go:181: the result of zrange: [{0 d} {1 a} {4 c} {6 b}]
=== RUN TestLoginCookies/Sort_operation
redisConn_test.go:188: result of sort: [7 15 23 110]
redisConn_test.go:190: result of sort: [110 15 23 7]
redisConn_test.go:196: result of sort: [15 110 7 23]
redisConn_test.go:198: result of sort: [1 3 5 9]
=== RUN TestLoginCookies/Set_expire
redisConn_test.go:212: the rest time: 1m40s
=== RUN TestLoginCookies/Test_transaction
1
2
3
2
1
0
=== RUN TestLoginCookies/Publish_and_subscribe
Message<channel: 6>
1
Message<channel: 5>
2
Message<channel: 4>
3
Message<channel: 3>
4
unsubscribe success
Message<channel: 2>
5
Message<channel: 1>
6
--- PASS: TestLoginCookies (7.16s)
--- PASS: TestLoginCookies/Test_INCR_and_DECR (0.00s)
--- PASS: TestLoginCookies/Operation_on_substring_and_bit (0.01s)
--- PASS: TestLoginCookies/Operation_on_list (0.00s)
--- PASS: TestLoginCookies/Block_pop (2.12s)
--- PASS: TestLoginCookies/Operation_of_set (0.00s)
--- PASS: TestLoginCookies/Operation_on_hash (0.00s)
--- PASS: TestLoginCookies/Operation_on_zset (0.01s)
--- PASS: TestLoginCookies/Sort_operation (0.00s)
--- PASS: TestLoginCookies/Set_expire (2.00s)
--- PASS: TestLoginCookies/Test_transaction (1.00s)
--- PASS: TestLoginCookies/Publish_and_subscribe (2.00s)
PASS
ok command-line-arguments 7.160s
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter04/redisConn_test.go -v
=== RUN Test
=== RUN Test/Test_list_item
redisConn_test.go:16: We need to set up just enough state so that a user can list an item
redisConn_test.go:21: The user's inventory has: [itemX]
redisConn_test.go:24: Listing the item...
redisConn_test.go:26: Listing the item succeeded? true
redisConn_test.go:29: The market contains: [{10 itemX.userX}]
redisConn_test.go:30: The inventory:
=== RUN Test/Test_purchase_item
redisConn_test.go:38: We need to set up just enough state so a user can buy an item
redisConn_test.go:42: The user has some money: map[funds:125]
redisConn_test.go:46: Purchasing an item succeeded? true
redisConn_test.go:49: UserY money is now: map[funds:115]
redisConn_test.go:56: UserX money is now: map[funds:10]
redisConn_test.go:63: Their inventory is now: [itemX]
--- PASS: Test (0.01s)
--- PASS: Test/Test_list_item (0.00s)
--- PASS: Test/Test_purchase_item (0.00s)
PASS
ok command-line-arguments 0.010s
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang 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-06 19:08:04.85444159 +0000 UTC this is message 4
redisConn_test.go:30: 2023-04-06 19:08:04.853624196 +0000 UTC this is message 3
redisConn_test.go:30: 2023-04-06 19:08:04.853005101 +0000 UTC this is message 2
redisConn_test.go:30: 2023-04-06 19:08:04.852840703 +0000 UTC this is message 1
redisConn_test.go:30: 2023-04-06 19:08:04.852521805 +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: {109 message-5}
redisConn_test.go:47: {80 message-4}
redisConn_test.go:47: {65 message-3}
redisConn_test.go:47: {38 message-2}
redisConn_test.go:47: {11 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: 3
redisConn_test.go:64: These counters include:
redisConn_test.go:70: [1680808080 3]
redisConn_test.go:70: [1680808085 13]
redisConn_test.go:70: [1680808090 10]
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: 44 zincrby stats:temp:example 13 sum: 447 zincrby stats:temp:example 169 sumq: 4663]
redisConn_test.go:94: Which we can also fetch manually:
redisConn_test.go:96: stddev 1.6836171168631278
redisConn_test.go:96: min 8
redisConn_test.go:96: max 13
redisConn_test.go:96: count 44
redisConn_test.go:96: sum 447
redisConn_test.go:96: sumq 4663
redisConn_test.go:96: average 10.159090909090908
=== 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-8
redisConn_test.go:112: req-7
redisConn_test.go:112: req-3
redisConn_test.go:112: req-9
redisConn_test.go:112: req-6
redisConn_test.go:112: req-4
redisConn_test.go:112: req-0
redisConn_test.go:112: req-5
redisConn_test.go:112: req-2
redisConn_test.go:112: req-1
=== 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/06 19:08:19 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 directory
FAIL command-line-arguments 14.208s
FAIL
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter06/redisConn_test.go -v
=== RUN Test
=== RUN Test/Test_add_update_contact
redisConn_test.go:24: Let's add a few contacts...
redisConn_test.go:28: Current recently contacted contacts
redisConn_test.go:31: contact-3-9
redisConn_test.go:31: contact-2-8
redisConn_test.go:31: contact-2-7
redisConn_test.go:31: contact-2-6
redisConn_test.go:31: contact-1-5
redisConn_test.go:31: contact-1-4
redisConn_test.go:31: contact-1-3
redisConn_test.go:31: contact-0-2
redisConn_test.go:31: contact-0-1
redisConn_test.go:31: contact-0-0
redisConn_test.go:35: Let's pull one of the older ones up to the front
redisConn_test.go:38: New top-3 contacts:
redisConn_test.go:40: contact-1-4
redisConn_test.go:40: contact-3-9
redisConn_test.go:40: contact-2-8
redisConn_test.go:44: Let's remove a contact...
redisConn_test.go:47: New contacts:
redisConn_test.go:49: contact-1-4
redisConn_test.go:49: contact-3-9
redisConn_test.go:49: contact-2-8
redisConn_test.go:49: contact-2-7
redisConn_test.go:49: contact-1-5
redisConn_test.go:49: contact-1-3
redisConn_test.go:49: contact-0-2
redisConn_test.go:49: contact-0-1
redisConn_test.go:49: contact-0-0
redisConn_test.go:53: And let's finally autocomplete on
=== RUN Test/Test_address_book_autocomplete
redisConn_test.go:69: the start/end range of 'abc' is:
redisConn_test.go:71: abb{ abc{
redisConn_test.go:73: Let's add a few people to the guild
redisConn_test.go:77: now let's try to find users with names starting with 'je':
redisConn_test.go:79: [jeff jennifer jenny]
=== RUN Test/Test_list_item
redisConn_test.go:84: We need to set up just enough state so that a user can list an item
redisConn_test.go:89: The user's inventory has: [itemX]
redisConn_test.go:92: Listing the item...
redisConn_test.go:94: Listing the item succeeded? true
redisConn_test.go:97: The market contains: [{10 itemX.seller}]
redisConn_test.go:98: The inventory:
=== RUN Test/Test_purchase_item_with_lock
redisConn_test.go:107: We need to set up just enough state so a user can buy an item
redisConn_test.go:112: The user has some money: map[funds:125]
redisConn_test.go:116: Purchasing an item succeeded? true
redisConn_test.go:120: buyer's money is now: map[funds:115]
redisConn_test.go:127: seller's money is now: map[funds:10]
redisConn_test.go:134: Their inventory is now: [itemX]
=== RUN Test/Test_distributed_locking
redisConn_test.go:141: Getting an initial lock...
redisConn_test.go:143: Got it!
redisConn_test.go:144: Trying to get it again without releasing the first one...
redisConn_test.go:146: Failed to get it!
redisConn_test.go:147: Waiting for the lock to timeout...
redisConn_test.go:149: Getting the lock again...
redisConn_test.go:152: Got it!
redisConn_test.go:153: Releasing the lock...
redisConn_test.go:155: Released it...
redisConn_test.go:156: Acquiring it again...
redisConn_test.go:158: Got it!
=== RUN Test/Test_counting_semaphore
redisConn_test.go:163: Getting 3 initial semaphores with a limit of 3...
redisConn_test.go:167: Done!
redisConn_test.go:168: Getting one more that should fail...
redisConn_test.go:170: Couldn't get it!
redisConn_test.go:171: Lets's wait for some of them to time out
redisConn_test.go:173: Can we get one?
redisConn_test.go:176: Got one!
redisConn_test.go:177: Let's release it...
redisConn_test.go:179: Released!
redisConn_test.go:180: And let's make sure we can get 3 more!
redisConn_test.go:184: We got them!
=== RUN Test/Test_delayed_tasks
redisConn_test.go:189: Let's start some regular and delayed tasks...
redisConn_test.go:194: How many non-delayed tasks are there (should be 2)? 2
redisConn_test.go:196: Let's start up a thread to bring those delayed tasks back...
redisConn_test.go:199: Started.
redisConn_test.go:200: Let's wait for those tasks to be prepared...
redisConn_test.go:205: Waiting is over, how many tasks do we have (should be 4)? 4
=== RUN Test/Test_multi_recipient_messaging
redisConn_test.go:211: Let's create a new chat session with some recipients...
redisConn_test.go:213: Now let's send a few messages...
redisConn_test.go:217: And let's get the messages that are waiting for jeff and jenny...
redisConn_test.go:220: They are the same? true
redisConn_test.go:222: Those messages are: [{1 [{1 1680808110 joe message 1} {2 1680808110 joe message 2} {3 1680808110 joe message 3} {4 1680808110 joe message 4}]}]
=== RUN Test/Test_file_distribution
redisConn_test.go:232: Creating some temporary 'log' files...
redisConn_test.go:242: Done.
redisConn_test.go:244: Starting up a thread to copy logs to redis...
redisConn_test.go:251: Let's pause to let some logs get copied to Redis...
redisConn_test.go:254: Okay, the logs should be ready. Let's process them!
redisConn_test.go:268: Files should have 1, 10000, and 100000 lines
Finished with a file 0, linecount: 1
Finished with a file 1, linecount: 10000
Finished with a file 2, linecount: 100000
redisConn_test.go:272: Let's wait for the copy thread to finish cleaning up...
redisConn_test.go:273: Done Cleaning out Redis!
--- PASS: Test (5.41s)
--- PASS: Test/Test_add_update_contact (0.01s)
--- PASS: Test/Test_address_book_autocomplete (0.00s)
--- PASS: Test/Test_list_item (0.01s)
--- PASS: Test/Test_purchase_item_with_lock (0.01s)
--- PASS: Test/Test_distributed_locking (1.01s)
--- PASS: Test/Test_counting_semaphore (2.01s)
--- PASS: Test/Test_delayed_tasks (2.01s)
--- PASS: Test/Test_multi_recipient_messaging (0.00s)
--- PASS: Test/Test_file_distribution (0.35s)
PASS
ok command-line-arguments 5.413s
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter07/redisConn_test.go -v
=== RUN Test
=== RUN Test/Test_index_document
redisConn_test.go:20: We're tokenizing some content...
redisConn_test.go:22: Those tokens are: [random content look indexed]
redisConn_test.go:25: And now we are indexing that content...
=== RUN Test/Test_set_operations
=== RUN Test/Test_parse_query
=== RUN Test/Test_parse_and_search
redisConn_test.go:68: And now we are testing search...
redisConn_test.go:86: Which passed!
=== RUN Test/Test_search_with_sort
redisConn_test.go:91: And now let's test searching with sorting...
redisConn_test.go:103: Which passed!
=== RUN Test/Test_search_with_zsort
redisConn_test.go:108: And now let's test searching with sorting via zset...
redisConn_test.go:124: Which passed!
=== RUN Test/Test_string_to_score
=== RUN Test/Test_index_and_Target_ads
=== RUN Test/Test_is_qualified_for_job
=== RUN Test/Test_index_and_find_jobs
=== RUN Test/Test_index_and_find_jobs_levels
redisConn_test.go:217: now testing find jobs with levels ...
redisConn_test.go:234: which passed
=== RUN Test/Test_index_and_find_jobs_years
redisConn_test.go:239: now testing find jobs with years ...
redisConn_test.go:256: which passed
--- PASS: Test (0.12s)
--- PASS: Test/Test_index_document (0.00s)
--- PASS: Test/Test_set_operations (0.00s)
--- PASS: Test/Test_parse_query (0.00s)
--- PASS: Test/Test_parse_and_search (0.00s)
--- PASS: Test/Test_search_with_sort (0.00s)
--- PASS: Test/Test_search_with_zsort (0.00s)
--- PASS: Test/Test_string_to_score (0.00s)
--- PASS: Test/Test_index_and_Target_ads (0.10s)
--- PASS: Test/Test_is_qualified_for_job (0.00s)
--- PASS: Test/Test_index_and_find_jobs (0.00s)
--- PASS: Test/Test_index_and_find_jobs_levels (0.00s)
--- PASS: Test/Test_index_and_find_jobs_years (0.00s)
PASS
ok command-line-arguments 0.126s
@rilma ➜ /workspaces/redis-in-action/golang (master) $ docker exec -it redis-in-action-golang go test ./Chapter08/redisConn_test.go -v
=== RUN Test
=== RUN Test/Test_create_user_and_status
=== RUN Test/Test_follow_and_unfollow_user
=== RUN Test/Test_syndicate_status
=== RUN Test/Test_refill_timeline
--- PASS: Test (0.84s)
--- PASS: Test/Test_create_user_and_status (0.00s)
--- PASS: Test/Test_follow_and_unfollow_user (0.00s)
--- PASS: Test/Test_syndicate_status (0.21s)
--- PASS: Test/Test_refill_timeline (0.62s)
PASS
ok command-line-arguments 0.843s
@rilma ➜ /workspaces/redis-in-action/golang (master) $