Skip to content

Commit

Permalink
rft: using the e2e build tag to idetify the end to end tests (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash committed Jun 25, 2023
1 parent 0dac997 commit 2e01499
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 36 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Go
name: Integration Test

on:
push:
Expand All @@ -30,9 +30,6 @@ jobs:
with:
go-version: 1.18

- name: Build
run: go build -v ./...

- name: Test
run: sh ./script/integrate_test.sh

Expand Down
41 changes: 13 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,16 @@
# Copyright 2020
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


##@ General

# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php

#Copyright 2014 beego Author. All Rights Reserved.
##
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
##
# http://www.apache.org/licenses/LICENSE-2.0
##
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
.PHONY: ut
ut:
@go test -race ./...
Expand Down
2 changes: 2 additions & 0 deletions memcache/memcache_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e

package memcache

import (
Expand Down
4 changes: 2 additions & 2 deletions random_expired_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
// RandomExpireCacheOption implement genreate random time offset expired option
type RandomExpireCacheOption func(*RandomExpireCache)

// WithOffsetFunc returns a RandomExpireCacheOption that configures the offset function
func WithOffsetFunc(fn func() time.Duration) RandomExpireCacheOption {
// WithRandomExpireCacheOffsetFunc returns a RandomExpireCacheOption that configures the offset function
func WithRandomExpireCacheOffsetFunc(fn func() time.Duration) RandomExpireCacheOption {
return func(cache *RandomExpireCache) {
cache.offset = fn
}
Expand Down
4 changes: 2 additions & 2 deletions random_expired_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ func TestRandomExpireCacheGetMulti(t *testing.T) {
testMemoryCacheGetMulti(t, cache)
}

func TestWithOffsetFunc(t *testing.T) {
func TestWithRandomExpireCacheOffsetFunc(t *testing.T) {
bm := NewMemoryCache(20)
magic := -time.Duration(rand.Int())
cache := NewRandomExpireCache(bm, WithOffsetFunc(func() time.Duration {
cache := NewRandomExpireCache(bm, WithRandomExpireCacheOffsetFunc(func() time.Duration {
return magic
}))
// offset should return the magic value
Expand Down
2 changes: 2 additions & 0 deletions redis/redis_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build e2e

package redis

import (
Expand Down

0 comments on commit 2e01499

Please sign in to comment.