Gated Migrations: my gift to Steemit devs, and the world! A superior testing framework.steemCreated with Sketch.

in #steemgigs7 years ago (edited)

http://gatedmigrations.com

Gated Migrations from grow-pro, 2017-10-27 Fri.jpeg

My Background

I have spent decades in software development, wearing the three major hats of Engineering: Developer, Builder, and Tester. This has given me a broad view of the software development lifecycle, and contributed to my development of the system I describe below, which I have termed “Gated Migrations.”

New Definition of “IPO” :)

I view everything as having three attributes:

  1. inputs;
  2. processing; and
  3. outputs.

Thus, the input to developers is the specification; their process is to write code; and their output goes to the build team.

The build team’s process is to repeatedly and deterministically build from the source code the developers provide; and their output goes to the testers.

The testers’ process is to verify functionality is working; their output goes to the customers.

Where Did This Come From?

At one point, between “software companies,” I worked at a company which provided services for people who phoned in. They were not a “technology” company; they were a phone bank, with some developers. It was the worst company I’ve ever worked for, in terms of their use of technology.

They had several environments, all of which were tested in manually (and, the manual testers played games at their desks while waiting for the next test cycle, really unprofessional – and with management’s consent!):

  1. Production;
  2. Staging;
  3. QA;
  4. Dev testing.

The final one was “Production”, which had all the hardware. There was “Staging” which was very similar to Production, but was lacking some hardware, so not all tests could be performed. I would not do it this way; Staging should be identical to Production, because you would want all the tests to run and pass, prior to deploying to the customer-facing environment.

Before that there was “QA” with even less hardware, and then “Dev testing” which was on the developer’s machine, and generally only tested the software; some devs had some hardware.

So, Tell Me About the Gates?

Microsoft’s Team Foundation Server (TFS) has a feature called “Gated Checkins”, where rules can be configured to run tests when a developer does a checkin, and refuse the checkin if the tests fail. This is excellent, but it couldn’t run hardware tests. Developers were constantly checking in code that broke the tests, which fortunately were discovered (mostly!) in environments prior to Production.

Bugs would often make it to Production and then “failure to properly plan” on the developers’ part became an “emergency” on the rest of the company’s part. “Fighting fires” was a routine operation, and should not be.

One major benefit to the Gated Checkins feature was that code that broke the tests would never make it into the codebase, which is much better from an organizational perspective. Other source control systems have similar features.

The idea of the “gates” in “Gated Migrations” is so that tests can be performed in an environment until they’re done, and then if more code had been checked in, the environment can be immediately refreshed and more tests performed. I’ve used Mozilla’s Tinderbox before and the idea is similar, although that was more “only for builds” whereas this tests the code changes all the way through to Production, automatically. More recently I’ve used Hudson which turned into Jenkins, and is an excellent CI (Continuous Integration) framework. I would probably use Jenkins as the basis for this system.

One caveat to fully automated deployment: having a human decide when Production gets updated is probably a good thing – but, I designed it to be flexible, so it would be able to help at multiple companies, not only the one I was in; that’s a feature I try to put into the automation I develop – I want it to be able to apply as widely as possible, within reason. It may take a little more time to produce, but the added configurability makes it more powerful, and usable in many more situations – meaning, it’s more commercially viable if I wanted to go that route. And even if I don’t (I’m giving it away, here), even if it’s open source, I would want it to be able to help as many as possible.

The Process, Broken Down

So, a developer has made changes to code. They check it in, and a Gated Checkins process verifies that the code passes rudimentary tests, and allows the checkin if so.

Note that “Gated Checkins” is the Microsoft TFS term for it. Other version control systems have “hooks” and “conditions”, which are similar – if it fails the test, it’s not checked in. And, this is not essential to the “Gated Migrations” system; it works in conjunction with it, helping to reduce inefficiency – the idea being that the checkin tests should happen quicker than an entire pass through an environment.

The system waits until the first environment is available. At that point, it checks to see if other unrelated code changes had been performed. For instance, let’s say there are modules A, B, and C. One developer changes A; another developer changes B; and three developers make different changes to C (call them C1, C2, and C3), all before the environment becomes available.

This then (without any additional code changes happening while the tests are ongoing) would require three passes through this (and, each) environment:

  1. The first pass would include A, B, and C1;
  2. the second pass would test C2;
  3. and the third pass would test C3.

What’s a Pass?

Each “pass” would entail several steps:

  1. Refresh the environment;
  2. Deploy the new modules;
  3. Notify automated and manual testers;
  4. Wait for test completion;
  5. Wait for new code needing to be tested; and
  6. Repeat.

Refreshing the environment is generally as simple as reverting a VM (or several) to a state where the module hadn’t been deployed yet, and also perhaps sending a refresh signal to specific hardware, or automating a power cycle for specific hardware (and waiting for the device to be ready).

Deploying the new modules can happen in several ways. Some source code might be “as is”, i.e., HTML, CSS, etc. Others might be executables, built by the build team. And still others could be installers, also generally packaged by the build team. So the system would either copy the files or executables, or run the installer. If anything failed in this section, it would report an error and the associated module’s checkin would be flagged as potentially suspect – although “something else” may have gone wrong, for instance a power or network glitch; detecting for such would make the system more robust.

It would deploy as many separate modules as possible, while testing only one code change at a time, per module (as described above with A, B, C1, C2 and C3). The idea being “change only one variable at a time” – if we were to test changes by two different developers (e.g., C1 and C2) and the test failed, it would not be certain which developer to notify; in that situation, I’d have it notify both developers, with wording to indicate that it might be either or both that caused the failure. And of course, scaling to “N” developers, not just two; some tests may take hours, meaning several devs could check in during that time.

Also note that some tests may test multiple modules, so if there was a test which tests both A and B, and it failed during the first pass above (testing A, B, and C1), the developers who checked in to A and B would both be notified, with wording as above.

And, it could flag those checkins internally, so that it wouldn’t deploy them for future tests – in other words, if A and B failed in the first pass of the example, then when it went to test C2 on the second pass, the A and B modules it would deploy to that environment would be “A-1” and “B-1”, in other words, the most recent checkin to have passed the tests. Note that this paragraph describes “extra credit” as it could just keep failing until a dev fixed those errors and checked in new code. I’d probably leave this out of the first version, but put it on the roadmap. And, there may be situations where modules are interdependent, for instance A makes calls to a function in B, and that function changes; if B failed but A didn’t, then the next pass, “B-1” is deployed which has the old API call, and A tried to call the new one, and then A fails! Investigating that failure of A would be time wasted, and also might cause “A-1” to be deployed next along with “B” (which would fail since they’re again mismatched). This also might cause an alternating cycle, until new code is checked in to either A or B, and we’d want to avoid that situation as well.

Fortunately, a lot of what I describe in the above is “edge cases”, i.e., they don’t happen generally. However, we need to code in the “edges” so the system doesn’t “fall off the table.”

Notifying the manual and automated testers would be in two parts: the first being an email, page, text, instant message, etc. to the manual testers; and, an API call for the automated ones. When manual testers completed, they’d click a link on a web page (or perhaps in the email it sent); and when automated tests completed, they’d perform another API call to inform the system that the automated tests were complete.

The system would wait until it heard back from all manual and automated testers that it had notified. It would also have a configurable timeout; for instance if tests generally took an hour, it could be configured to 2 hours to notify management. It could also take metrics on run times, and set the timeout dynamically, with configurable thresholds, e.g. “200%”, or “150%”, etc. And, I’d have it generate two emails, “warning” and “emergency”.

In fact, another “extra credit” item could be to force-stop hanging tests. There could be three settings, the above “warning” and “emergency”, and a third “forced restart”, with them set to, for instance, “120%”, “200%”, and “300%”. So if the test usually took an hour, it’d alert management with a warning if the tests ran 12 minutes over time; with an emergency if the tests ran an hour over; and if nobody responded, it’d reset the environment if the tests ran two hours over, and refresh it for the next set of deployments to be tested.

Another aspect to the above “extra credit” would be that there should be a “hang on, we’re investigating this environment” button so it would not do the “forced restart”. Some bugs may require developers to use a debugger in the environment, for instance with hardware the dev doesn’t have on their machine.

Once management is alerted to a “warning” or “emergency”, they could look into whether a test hung, or perhaps a manual tester was out, or on break/lunch/vacation, etc. Hmm, another “extra credit” – the system should integrate with HR and be able to “know” when people were out. It could have primary/secondary/etc. for each test, so it would know who to notify in order to get the tests completed in the least amount of time, regardless of who was in the office that day.

Once the system was notified that testing had completed, it would check for new code, and if any code had been checked in while the tests had been running, it would immediately refresh the environment and start the process over again. One goal being, to keep the tests running as close to 100% of the time as possible.

Environmental Expansion: Cloning and Splitting

The system would maintain metrics on environmental usage. If an environment was in use for more than 90% of the time for a certain period of time (configurable; perhaps a day, or a week – also, the “90%” value should be configurable as well), it would email management suggesting that they clone the environment; for instance, the tests that run in Staging are generally more than those that run on the developer’s machine, meaning they’ll generally have a longer run time. So they could set up “Staging1” and “Staging2”, and the system would then choose to deploy to them in round-robin fashion; whichever was available would be deployed to, and if both were available, Staging1 would be deployed to. (Again, this expands to “N”.)

Additionally, environments could be “split” e.g. “Staging1A” and “Staging1B”, where A would run the tests for module A, and B the tests for module B, etc. The system could be configured to automatically alert management when an environmental split would be advantageous; for instance, it could be configured to send an email when tests run longer than an hour.

Feedback is Essential!

The more time between the developer checking the code in, and getting feedback that a test had failed, the more time (generally) it’ll take to fix it. If the developer is informed immediately, they generally still have the code “in their head” and can make a fix more quickly than if they have to go back over it – for instance, if they had moved on to fixing a bug in another module. So it’s a good goal to have tests completed ASAP, and both cloning and splitting the environments can help achieve that.

Of course, management has to balance that against expenses; each environment has a cost associated to set up and maintain. For instance, additional VM(s), and perhaps more hardware to be tested with – which could be very expensive, for instance nuclear plant control systems (I’ve worked at a nuclear plant, but it was at the beginning of my career so I didn’t have this system in mind, back then).

This section aligns with what I learned in Psych 101, that correction after errant behavior should come as soon as possible after the behavior; hitting your dog an hour after they peed on the floor, for instance, it might not associate your wrath with its urination.

Branching

Source control/version control systems like Subversion, GIT, Perforce, etc. can be configured with multiple branches. For instance, with the above environments we could have the following branches:

  1. dev
  2. qa
  3. staging
  4. production

A developer would (generally) only have permissions to check in to the dev branch. The system would perform those tests, and if it passed all the tests, it would automatically merge the code to the qa branch, which the QA environment would be configured to deploy from. Similarly for staging and production, as long as the tests passed in the previous environment.

If there was a bug in a branch after dev, then the team lead or management would have permissions to check in to the other branches to fix it; or, the developer could be given temporary or permanent permission, if the team is smaller for instance.

I Can’t Develop This :(

I’m recovering from four concussions in the past four years, which have disabled me. The major symptoms are forgetfulness, headaches, irritability, and sleep issues. The forgetfulness is the worst, because while developing software one needs to maintain multiple variables in one’s head; as these leak out, my development speed slows way down. This causes headaches, and the irritability causes me to yell and swear and cry at the computer. This would not be acceptable in a business environment, and also, I don’t like doing those behaviors, so I’ve stopped trying to develop software, for now.

If anybody wants to run with this idea, it’s all yours.

If you’d like me involved, I’d be happy to help in any way I can.

 

Credits

This post was inspired by this comment which I had made to @grow-pro. Thanks to him for the encouragement to flesh this out!




Sort:  

I'd really like to see some hairspray on this flame! 🔥
I Resteemed but I'm going to jump on a machine real fast and drop it in the Liberty Professionals chat and a few others - let's get some eyes on this!!

This sort of benchmark approach would spare many users a miserable experience. I'm really not sure why they would roll out features into the wild without testing them and bug hunting first. Maybe they do test first, maybe I'm wrong.. Lately it has been a shit-show, so it would be hard to believe they do.

I'd like the focus to be on accessibility and uptime instead of SMTs (which should not even be in focus) if you ask me. Just my 2¢ in the STEEM pot.

I know there is plenty of talent on this platform, just have to blast the bat signal out to gather them. I'd love to see this get traction and keep Steemit steeming & not let it turn into a grease fire.

Thanks for your help!

Just don't spray the fiery hair product towards the grease... :)

Your inspiration continues! I set WordPress up at that site, and copy/pasted this post over, with very little formatting changes; and added a link to this post at the top.

Enjoy! http://gatedmigrations.com/

Sweet! I replied to our previous chat with a cover image, but in case you don't see it • already on steemimg host https://steemitimages.com/0x0/https://steemitimages.com/DQmQaVGtx8i3EoreGMVKBG7gMZKUP6MoxASdvLr62PW3H4A/Gated-Migrations-STEEMIT-POST-COVER-libertyteeth.jpg

It was fun to make so worst case we just marvel at it for a moment..lol Use it if you wish and however you'd like - here or on the wordpress site. I mean..it does have your name on it, so...you own it now. 😆

Man, you're busy today! I need to chat with @Ned to get you a per diem slip so you can get on payroll.

Wow, thanks so much! I'm honored, really it looks great!

Just replaced the large image at http://gatedmigrations.com with it. I left the mockup I made as the smaller image, I actually think it looks quite good when reduced.

I saw your shout-outs in chat as well, thanks!

My pleasure. It's fun to do what I love to do for people that enjoy it. I'm happy you can put it to use. When I heard 'gated migration' I thought of literal gates and then I thought about this image I took at the beach; fencing for the sand dunes
beach-w-grow-pro.jpg

Then the "V" formation I had from the same trip, some seagulls flying above the ocean.
beach-w-grow-pro2.jpg
So I cut the birds out and merged them with the sand dune photo and added some more birds because why not..LOL The a little resize and crop...Then whammy.
steemit-coin-logo-growpro-style-1.png
And I had designed a new Steem logo png that I have yet to release into the wilderness, but I added in there ;)

That's another freebie for the steem-folk, public domain. Use as you wish.

Yeah, I blasted that post on all my chats haha I really think it should be considered. I want to see this platform thrive because I'm pretty much done with social media otherwise.

And...Bonus time! I made this a few years back and still enjoy it (using the same photo of the sand dunes!):
dream24hours_water_neon_04.jpg
Photoshopped the water in there with some paint and reflected the image and skewed it to suggest water reflecting light.

I'm going to drop the http://gatedmigrations.com link to a few friends and see if I can turn up some help. If there's anything I can do to help you just let me know. I know it's something you obviously know a great deal about. I'd love to see this take hold. Maybe that could be a community on steemit? I have heard there is/was/may be a community feature in the pipeline.

#libertyprofessionals take care of each other. We are always just a message away if you ever need an ear.

because why not

LOL!

Thanks I really appreciate the step-by-step! I updated this post with a link to the site at the top, and replaced my mock-up with your wonderful image.

That Steemit logo looks great!

I showed a friend last night the picture on my wall and he said he wanted to buy one!

So I'm learning how to watermark using Gimp today, so I can make a gallery somewhere (perhaps at http://libertyteeth.xyz ?), and list them for sale at various sizes etc.

Also need to research pricing...

Wow @libertyteeth this is brilliant. I hope the steemit dev team will take note of this.

I have also been wanting to ask you how you are doing with your health condition?

Thanks! This is what I did for most of my life; I didn't need to look anything up to write it. :)

My concussion symptoms are still giving me trouble. Stopped drinking a few days ago, which is causing even more difficulty falling asleep (apparently, I was self-medicating), but that's hopefully temporary. And I've finally seen a doctor for my psoriasis, although it's not really being resolved by the treatment so I'll have to go back soon. I'll have medical insurance in a week or less, and will go back then.

Hope you're well! I see a cucumber sitting on the counter as I type this -- say hi to your mom for me! :) (I realize that out of context this might be odd, so, to others: I have a garden and shared pictures of produce, and Yanniv said his mom really likes to eat cucumbers -- I think she had just gone to market to get one IIRC.)

Hahahahaha. @libertyteeth your memory is back. So you still were able to remember when i said my mom loves cucumber. This shows that your memory is good. Wow, this is interesting. I think you recovering fine. Cheers.

really impressive writing, though i have lack of knowledge about technical and developing codec.

holy cow liberty I would be lying if I said i understood everything you wrote about. What so can say is that I’m confident staying on steemit when people of such technical prowess are roaming the halls and holding Steem. Cheers and hope your injuries heal because it seems you use that brain A LOt!

Thanks! Your ending is accurate -- my left eye was broken at birth, and I said for many years that the neurons that would have gone towards serving that input, were repurposed to make me more intelligent. :)

A month or so before my first concussion, I hear a science report on the radio which tested three groups of people: congenitally blind; those who lost sight after birth; and normally-sighted. The congenitally blind scored higher on both quality and quantity of recall, on words of lists.

The interviewer asked "what does 'quality' mean?", and the answer was that each list was about a specific subject, but that subject wasn't in the list; for instance, a list about "King" would have "Queen", "Palace", "Royalty", "Throne", "Prince" etc in it, but not "King". The latter two groups would mis-remember "King" as having been in the list more often than the congenitally blind; that's what 'quality' meant.

The interview ended with saying "the visual cortex is almost half the brain, so, the congenitally blind have an extra half-brain to play with" -- and I immediately thought, "I've got an extra quarter-brain!" :)

This is great, except, the neuro-psych testing which the insurance companies required showed me passing "with flying colors" except there was no way I could do my job then. Had to get an attorney to get the short-term disability payments, which of course threw 1/3 of them away (the attorney's fee). At least with the second concussion which took me out of work, the insurance company treated me better (and was a different company; not sure whether that was as a result of the first company's treatment of me, which I hadn't thought of before just now, or at least, I don't remember thinking it, which happens a lot for things I have already thought... :/ ).

Wow.. I have heard of heightened senses due to a "defect", but I have never heard of the visual cortex as "half the brain". Careful because some very UN-intelligent people may start poking out their eyes thinking it might make them smarter lol!

In any case, I know it may be private but just wondering; what was the concussion from? Glad your insurance took care of you. I'm assuming then it was someone else's accident.

First was a car accident but more like getting hit by a train -- a large construction vehicle decided to come out from a side street into my right-of-way, I tried to get ahead of it, hit me about where the gas cap is. My head hit the "oh shit" bar, a blow to the left side, near the temple.

Second was an accident at home, a board hit me around the hairline, above my left eye and to the left a little.

Third was a too-short-cellar-doorway from the house I was moving out of, about 8 months ago; hit the top of my head.

Fourth was a few weeks ago, fell asleep talking to my wife and banged it off the bureau I was sitting on the bed next to. That hit just above the hairline in the center. So, I've had blows to many parts of the brain... :/

Please, nobody poke your eyes out! The "lost sight after birth" group was very close to the "normally sighted group" in terms of quality and quantity of recall; it was only the "congentially blind" group that had a significant difference.

Here's an interesting answer about the percentage used: https://www.quora.com/How-much-of-the-brain-is-involved-with-vision-What-about-hearing-touch-etc

[Oh, a "Transaction broadcast error" on this post about how to mitigate errors getting to Production. How quaint... :/ ]

Wow. Please don't take this the wrong way! But maybe start wearing a helmet ;P

Be safe this weekend! Protect the nogin'

be well my friend.

I've had that thought as well. Did you watch the old movie "Parenthood"? Kid had a helmet, someone asked his mom, and she said "He likes to bang his head into things." :)

Back atcha! :)

hahah just laughed out loud for real.. but no I haven’t seen that movie.Maybe i’ll check it out.. hilarious.

Laughter is the best medicine, or at least, that's a section in Reader's Digest. I should remember that more often, when I'm fight-or-flight. Thanks.

@libertyteeth always contributing to the community. They should definitely reach out to you. Thank you!

Thanks man! As the Beatles sang, "We're all doing what we can." :)

Wow, and looking up the full lyrics to that song ("Revolution"), I see the entire verse relates!

You say you got a real solution
Well, you know
We'd all love to see the plan
You ask me for a contribution
Well, you know
We're all doing what we can

I have a real solution, and outlined the plan above. Wild. I love coincidences, and know that they're God saying "hi". :)

Yes great coincidence... "Don't you know it's gonna be... alright!"

Awesome, thanks. I might have said this before, but -- I really enjoy when someone can take my wildly random juxtapositions to a higher level. Blessings.

Wow i like this.. Good job #libertyteeth

Very interessing concept @libertyteeth thanks for sharing with us

i hope they do something with your suggestions

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 68244.61
ETH 2640.30
USDT 1.00
SBD 2.69