Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add consumer test ( E2E ) #880

Merged
merged 23 commits into from
Dec 2, 2020

Conversation

idbeta
Copy link
Contributor

@idbeta idbeta commented Nov 26, 2020

Please answer these questions before submitting a pull request

  • Why submit this pull request?

  • Bugfix

  • New feature provided

  • Improve performance

  • E2E test

  • Related issues

@idbeta idbeta changed the title test: add consumer e2e test without username test: add consumer without username ( E2E ) Nov 26, 2020
@idbeta idbeta changed the title test: add consumer without username ( E2E ) test: add consumer without incorrect input ( E2E ) Nov 26, 2020
@idbeta idbeta changed the title test: add consumer without incorrect input ( E2E ) test: add consumer with incorrect input ( E2E ) Nov 26, 2020
@codecov-io
Copy link

codecov-io commented Nov 26, 2020

Codecov Report

Merging #880 (8e65c7f) into master (95f2612) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #880   +/-   ##
=======================================
  Coverage   43.10%   43.10%           
=======================================
  Files          18       18           
  Lines        1290     1290           
=======================================
  Hits          556      556           
  Misses        642      642           
  Partials       92       92           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 95f2612...8e65c7f. Read the comment docs.

api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
api/test/e2e/consumer_test.go Show resolved Hide resolved
api/test/e2e/consumer_test.go Outdated Show resolved Hide resolved
}
}

func TestConsumer_with_createtime_updatetime(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the testing framework? Is this test related to the title?

Copy link
Contributor Author

@idbeta idbeta Nov 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is used to test when the consumer is updated, it's create_time should not be updated and update_time should be updated. The current framework does not support obtaining update_time and create_time from the response, so I use standard library and assert to achieve it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @moonming

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @moonming Can you review it when you have time?

@membphis
Copy link
Member

membphis commented Dec 2, 2020

@idbeta CI failed: https://github.com/apache/apisix-dashboard/pull/880/checks?check_run_id=1483626371#step:5:85

it should be a bug.

--- FAIL: TestConsumer_with_createtime_updatetime (1.10s)
Error:     printer.go:54: PUT http://127.0.0.1:9000/apisix/admin/consumers
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x8c9e50]

goroutine 11 [running]:
testing.tRunner.func1(0xc000175300)
	/opt/hostedtoolcache/go/1.13.15/x64/src/testing/testing.go:874 +0x3a3
panic(0x956d60, 0xe4e4a0)
	/opt/hostedtoolcache/go/1.13.15/x64/src/runtime/panic.go:679 +0x1b2
e2e.TestConsumer_with_createtime_updatetime(0xc000175300)
	/home/runner/work/apisix-dashboard/apisix-dashboard/api/test/e2e/consumer_test.go:291 +0x350
testing.tRunner(0xc000175300, 0xa1a818)
	/opt/hostedtoolcache/go/1.13.15/x64/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.13.15/x64/src/testing/testing.go:960 +0x350
exit status 2
FAIL	e2e	1.893s
Error: Process completed with exit code 1.

@membphis
Copy link
Member

membphis commented Dec 2, 2020

@moonming @nic-chen please take a look at this PR

@idbeta
Copy link
Contributor Author

idbeta commented Dec 2, 2020

@idbeta CI failed: https://github.com/apache/apisix-dashboard/pull/880/checks?check_run_id=1483626371#step:5:85
Because the listening port of manager-api has changed, I have added new judgments.

@membphis
Copy link
Member

membphis commented Dec 2, 2020

@moonming please review this PR if you have time

@idbeta please change the title, your test case is not the same as this title.

@idbeta idbeta changed the title test: add consumer with incorrect input ( E2E ) test: add consumer test ( E2E ) Dec 2, 2020
@nic-chen
Copy link
Member

nic-chen commented Dec 2, 2020

LGTM

@nic-chen nic-chen merged commit 9e4c617 into apache:master Dec 2, 2020
@idbeta idbeta deleted the add-e2e-test-consumer2 branch December 9, 2020 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants