Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Fpetrilli/improve docs #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

FrankPetrilli
Copy link
Collaborator


Sometimes, we want to scale up or down our tests to compare against the size of a given architecture.

To this end, we can make use of the config.yml to define certain constants we wish to make use of. For an example of how to use this in a real test, see `config-writer.sh`, which creates the config.yml file from the user's input to automatically scale the tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider avoiding double "make use of" in the first sentence to keep the phrasing crisp.

Copy link
Contributor

Choose a reason for hiding this comment

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

While this is a good first stab it doesn't communicate the purpose or functionality of the config accurately enough. While currently we do use the config to specify the number of nodes in the cluster, we also use it to specify the number of pins that certain tests make (see param Y). In general the config is good for substituting any variables across tests. For more info look into @dgrisham's PR introducing it.


To this end, we can make use of the config.yml to define certain constants we wish to make use of. For an example of how to use this in a real test, see `config-writer.sh`, which creates the config.yml file from the user's input to automatically scale the tests.

```
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bit unclear that this statement goes in a config file. You should briefly hit on the config file's format and how it is activated (i.e. flag specifying path to kubernetes-ipfs, same folder as tests) too.

@@ -0,0 +1,14 @@
# Selectors
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice addition. Looking at this alongside other docs it's becoming clear the file organization I began here is not ideal. Right now its unclear what files are documenting what. This documentation has a different context from that documenting DSL features and our docs should convey that. I'm thinking either one large file with broader subsections (kubernetes-ipfs commands, The DSL, Kubernetes Config, etc) or perhaps separate files for each broader subsection.

Copy link
Contributor

Choose a reason for hiding this comment

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

On that note it would be good to have more background on the kubernetes config so that this section will make sense to people without a kubernetes background.

Copy link
Contributor

Choose a reason for hiding this comment

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

@FrankPetrilli both of these comments should be addressed before merging:

  1. Consolidate docs into one file or a few logically laid out files to make documentation more approachable
  2. Preface this specific section with background on the kubernetes config file that the selector key value pair goes into. Could be as simple as a link to existing kubernetes docs or a few concise sentences following a header.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, w.r.t. number 2, are you asking for an explanation of where labels go in a kubernetes yaml definition and their purpose?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds along the right track. I think the best answer is that I don't have the kubernetes context that you do to get much more specific. The labels exist in a file that I don't know much about. It would be great if the docs introduced me to this section without assuming I knew what that file is called, what it is used for and what its format is. imo the best way to do this is with the structure suggested in (1) including this section as a subsection of "the kubernets yaml definition"

Copy link
Contributor

Choose a reason for hiding this comment

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

or a name you think fits better :)

With in the confines of a 'step', adding the 'outputs' parameter allows the user to send the output from the command on a given line to a given name.
This can then be verified later to validate the output of a particular command.

The format is for a given `line`, save the output to the named variable `save_to`.
Copy link
Contributor

Choose a reason for hiding this comment

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

You should try to find a way to incorporate the append_to feature in this discussion too, perhaps referencing the iteration section.


Once the successes and failures have been talied up across runs for a particular test, the observed value is compared against the `expected` block.
If the observed value matches, `kubernetes-ipfs` will report that expectations were met, and returns a 0 exit code. If they don't match, it will return
a non-zero exit code, and state that the expectations were not met. This allows users to short-circut the tests and immediately fail in the event of a test failure
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by short-circuit the tests? Please be a little more specific here. It's been a while but I recall all steps being run even if an early step failed an assertion. Are you talking about short circuiting the times loop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I've attempted to address all your major comments in the latest changes, but this one I'm having some trouble trying to word.

What I'm trying to say is that since we run kubernetes-ipfs against a "test", when a test fails due to not matching expected values, one can take that into account by using its return value in a loop, something like:

for file in $(find tests -not -name 'config.yml' -name '*.yml' | sort)
do
    kubernetes-ipfs $file
    if [ $? -ne 0 ]; then
            echo "FAILED ON $file"
            break
    fi
done

Copy link
Contributor

Choose a reason for hiding this comment

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

ooh I see. In that case you're fine dropping the short circuit terminology altogether. I am assuming people reading these docs understand the benefit of setting exit codes.

@FrankPetrilli
Copy link
Collaborator Author

Okay, @ZenGround0, I think this covers everything you wanted changed. Thoughts?

@@ -0,0 +1,14 @@
# Selectors
Copy link
Contributor

Choose a reason for hiding this comment

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

@FrankPetrilli both of these comments should be addressed before merging:

  1. Consolidate docs into one file or a few logically laid out files to make documentation more approachable
  2. Preface this specific section with background on the kubernetes config file that the selector key value pair goes into. Could be as simple as a link to existing kubernetes docs or a few concise sentences following a header.


Sometimes, we want to run a particular test only against certain subsets of pods in the Kubernetes cluster (as we may be running multiple simultaneous tests together).

For this purpose, one can make use of the `selector` attribute under a test definition. This follows the kubernetes format of `key=value`, where some of the most common are the `run` key, which indicates a grouping of pods that are part of a particular rungroup.
Copy link
Contributor

Choose a reason for hiding this comment

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

A good example of how the above suggestion will improve readability: by spending some time explaining the kubernetes config format before diving into the specifics of the selector section, you will not need to make a digression explaining the general format and its common keys in the middle of explaining the selector attribute.

- A config file will be automatically found and used if named `config.yml` and in the same directory as the tests
- Specify the path to the config using the flag `--config`.

```
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be more readable if you specify that this snippet belongs in config.yml

@@ -0,0 +1,24 @@
# Test config

Sometimes, we want to scale up or down our tests to compare against the size of a given architecture.
Copy link
Contributor

Choose a reason for hiding this comment

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

While you have added some text incorporating the suggested change this line should be updated too. It is misleading as the opener of the test config section as it's not just variables that track with the size of an architecture that the test configuration allows a user to control (ex: expected successes, number of iterations)


## Outputs

With in the confines of a 'step', adding the 'outputs' parameter allows the user to send the output from the command on a given line to a given name.
Copy link
Contributor

Choose a reason for hiding this comment

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

small typo: "with in" -> "within"

@ZenGround0
Copy link
Contributor

@FrankPetrilli, still a few more things before this is ready to go. Let me know if you have any questions (feel free to ask in the comments, and tag my name so I don't miss it)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants