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

Add examples for documentation #57

Merged
merged 10 commits into from Mar 10, 2020
Merged

Add examples for documentation #57

merged 10 commits into from Mar 10, 2020

Conversation

@keyneston
Copy link
Contributor

keyneston commented Mar 5, 2020

These are mostly examples I wrote for the website proper, but I decided they would fit well in here.

There are a few small changes that fall out side of that.

  1. I added a small delay in one of the tests before test cleanup. This was due to it intermittently failing causing the tests to fail.
  2. I added a (*Client).Channel function which makes it easier to get a channel with known values. It doesn't make an API call in and of itself, just gives you an object that can be used for API calls.
@keyneston keyneston self-assigned this Mar 5, 2020
@keyneston keyneston requested a review from tbarbugli Mar 5, 2020
@keyneston

This comment has been minimized.

Copy link
Contributor Author

keyneston commented Mar 5, 2020

The test were failing a good portion of the time when it failed to cleanup a channel or channel type during tests. These errors just caused us to run the tests more which then caused more failed cleanup. Either way we end up with junk floating around in the test account. So I changed the cleanup portions of the test to not fail if an error was encountered.

@keyneston keyneston requested a review from bogdan-getstream Mar 6, 2020
@tbarbugli

This comment has been minimized.

Copy link
Member

tbarbugli commented Mar 8, 2020

The test were failing a good portion of the time when it failed to cleanup a channel or channel type during tests. These errors just caused us to run the tests more which then caused more failed cleanup. Either way we end up with junk floating around in the test account. So I changed the cleanup portions of the test to not fail if an error was encountered.

IMO the best solution to this problem is to not cleanup at all; have tests create data with random IDs and use it only for the current test. Adding a random prefix/suffix to names and IDs is usually the simplest way to keep stuff readable and unique 👉no cleanup.

@keyneston

This comment has been minimized.

Copy link
Contributor Author

keyneston commented Mar 9, 2020

@tbarbugli we already are doing the random prefix for the names and IDs. We can speed it up by not doing any deletes at all I guess.

data := map[string]interface{}{
"image": "https://path/to/image",
"created_by": "elon",
"roles": map[string]string{"elon": "admin", "gwynne": "moderator"},

This comment has been minimized.

Copy link
@thesyncim

thesyncim Mar 10, 2020

Contributor

roles can be a bit confusing (since you are adding a channel and role is a user property )

This comment has been minimized.

Copy link
@keyneston

keyneston Mar 10, 2020

Author Contributor

I'm not sure I understand what you are saying. The example was transliterated from the python. So this is just what the python one does 😁

@keyneston keyneston merged commit 9d343f2 into master Mar 10, 2020
4 checks passed
4 checks passed
Test & Build (1.12)
Details
Test & Build (1.12)
Details
Test & Build (1.13)
Details
Test & Build (1.13)
Details
@delete-merged-branch delete-merged-branch bot deleted the tabs/enh/add-examples branch Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.